CMR 2.0 M:N UNIDIRECTIONAL

Discussions

EJB design: CMR 2.0 M:N UNIDIRECTIONAL

  1. CMR 2.0 M:N UNIDIRECTIONAL (3 messages)

    I have a CMR between 2 EJBs, and many-many CMR, bur I want to implement it unidirectional, but OC4j standalone 9.0.3.0.0 insists on adding a collection mapping to my second bean. Is there any secret?

    MY ORIGINAL ORION-EJB-JAR.XML

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE orion-ejb-jar PUBLIC "-//Evermind//DTD J2EE Application runtime 1.2//EN"
    "http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd">

    <orion-ejb-jar deployment-version="9.0.3.0.0">

    <enterprise-beans>

    <entity-deployment name="Topico" location="Topico" data-source="jdbc/ejb/FAQDS1" table="TOPICOS">

    <primkey-mapping>
    <cmp-field-mapping>
    <fields>
    <cmp-field-mapping name="topicoId" persistence-name="CODTOPICO" persistence-type="NUMBER(10)"/>
    </fields>
    </cmp-field-mapping>
    </primkey-mapping>

    <cmp-field-mapping name="nome" persistence-name="NOME" persistence-type="VARCHAR2(50)"/>
    <cmp-field-mapping name="descricao" persistence-name="DESCRICAO" persistence-type="VARCHAR2(200)"/>
    <cmp-field-mapping name="ordem" persistence-name="ORDEM" persistence-type="NUMBER(2)"/>

    <cmp-field-mapping name="assuntos">
    <collection-mapping table="TOPICOS_ASSUNTO">
    <primkey-mapping>
    <cmp-field-mapping>
    <entity-ref home="Topico">
    <cmp-field-mapping>
    <fields>
    <cmp-field-mapping name="topicoId" persistence-name="CODTOPICO" />
    </fields>
    </cmp-field-mapping>
    </entity-ref>
    </cmp-field-mapping>
    </primkey-mapping>
    <value-mapping type="br.com.brasiltelecom.beans.faq.TopicoLocal">
    <cmp-field-mapping>
    <entity-ref home="Assunto">
    <cmp-field-mapping>
    <fields>
    <cmp-field-mapping name="assuntoId" persistence-name="CODASSUNTO" />
    </fields>
    </cmp-field-mapping>
    </entity-ref>
    </cmp-field-mapping>
    </value-mapping>
    </collection-mapping>
    </cmp-field-mapping>

    </entity-deployment>

    <entity-deployment name="Assunto" location="Assunto" data-source="jdbc/ejb/FAQDS1" table="ASSUNTO">

    <primkey-mapping>
    <cmp-field-mapping>
    <fields>
    <cmp-field-mapping name="assuntoId" persistence-name="CODASSUNTO" persistence-type="NUMBER(10)"/>
    </fields>
    </cmp-field-mapping>
    </primkey-mapping>

    <cmp-field-mapping name="nome" persistence-name="NOME" persistence-type="VARCHAR2(50)"/>
    <cmp-field-mapping name="descricao" persistence-name="DESCRICAO" persistence-type="VARCHAR2(200)"/>
    <cmp-field-mapping name="emails" persistence-name="EMAILS" persistence-type="VARCHAR2(200)"/>
    <cmp-field-mapping name="ordem" persistence-name="ORDEM" persistence-type="NUMBER(2)"/>

    </entity-deployment>
    </enterprise-beans>
    <assembly-descriptor/>
    </orion-ejb-jar>

    Threaded Messages (3)

  2. CMR 2.0 M:N UNIDIRECTIONAL[ Go to top ]

    Have you tried eliminating the <cmr-field> entry in <ejb-relationship-role>?
  3. CMR 2.0 M:N UNIDIRECTIONAL[ Go to top ]

    inside ejb-jar.xml? sure ... it doesn't work. OC4J keeps creating the mapping for my bean as my CMR was bidirectional. So I gave up, I implemented it as bidirectional ...but now I'm getting the following error when I try to get a collection mapped in my bidirectional relation:

    com.evermind.server.rmi.OrionRemoteException: Error (de-)serializing object: TopicoLocal_EntityBeanWrapper0

    Can anyone tell me what may be happening?
  4. CMR 2.0 M:N UNIDIRECTIONAL[ Go to top ]

    Hi Anderson,

    the first thing you need to check when you get a (de)serialization error is whether the class of the object being (de)serialized is accessible to the server or client component that is attempting the (de)serialization. This usually means that such a class must be in the classpath. In your case, we're talking about the TopicoLocal_EntityBeanWrapper0 class.

    If you want to further discuss your project you can send an email in Portuguese to my personal address:

     cristina at _removeThis_acm dot org

    Hope this helps,

    Cris