EJB Relation Definition

All,
My appoligies if this is a stupid question, but I have been reading up on this subject and I still do not quite understand what is needed and how to apply it to my specific situation.
What I have is a series of Oracle database views exposing data to our web service. We have chosen to use EJB's to expose that information to outside processes.
For this example I have two Database Views (Location and Citizen_Country) and two EJB's defined (Location and CitizenCountry). I want to have the CitizenCountry EJB invoke the Location EJB to pull up the country name and country code from the Location EJB for each record in the CitizenCountry EJB. The joining field in the views is COUNTRY_ID to GEO_LOC_ID.
If I was doing this in a standard SQL I would use a select * from Location l, CitizenCountry cc where l.geo_loc_id = cc.country_id;
I could also invoke both EJBs and combine the infromation before returing it.
What I want to be able to do is invoke the CitizenCountry EJB and have the NamedQuery inside it return all the records from CitizenCountry and the look-up data from Location as a single record. I would expect the Location information to be nested (ex. CitizenCountry.Location to get the location information).
Many thanks for any infromation to point me in the right direction.
Here are the definitions of the EJBs:
@Entity
@NamedQueries ({
@NamedQuery(name = "CitizenCountry.findAll",
query = "select o from CitizenCountry o"),
@NamedQuery(name = "CitizenCountry.findByAplId",
query = "select o from CitizenCountry o where o.aplId = :aplId_in")
@Table(name = "CITIZEN_COUNTRY")
public class CitizenCountry implements Serializable {
@Id
@Column(name="APL_ID", nullable = false)
private Long aplId;
@Column(name="COUNTRY_ID", nullable = false)
private Long countryId;
@Column(name="CS_DATE")
private Timestamp csDate;
@Column(name="CS_TO_DATE")
private Timestamp csToDate;
public CitizenCountry() {
@Entity
@NamedQueries ({
@NamedQuery(name = "Location.findAll", query = "select o from Location o"),
@NamedQuery(name = "Location.findAll", query = "select o from Location o where o.geoLocId = :in_GeoLocId")
@Table(name = "LOCATION")
public class Location implements Serializable {
@Column(name="CITY_CD")
private String cityCd;
@Column(name="CITY_CD_ALT")
private String cityCdAlt;
@Column(name="CITY_NM")
private String cityNm;
@Column(name="COUNTRY_CD")
private String countryCd;
@Column(name="COUNTRY_CD_ALT")
private String countryCdAlt;
@Column(name="COUNTRY_NM")
private String countryNm;
@Column(name="COUNTY_CD")
private String countyCd;
@Column(name="COUNTY_CD_ALT")
private String countyCdAlt;
@Column(name="COUNTY_NM")
private String countyNm;
@Id
@Column(name="GEO_LOC_ID", nullable = false)
private Long geoLocId;
@Column(name="STATE_CD")
private String stateCd;
@Column(name="STATE_CD_ALT")
private String stateCdAlt;
@Column(name="STATE_NM")
private String stateNm;
@Column(name="ZIP_CD")
private String zipCd;
public Location() {
}

Read about defining multiplicity in entity relationships here: http://download.oracle.com/javaee/6/tutorial/doc/bnbqa.html#bnbqh

Similar Messages

  • Missing ejb relation description file after deploying ejb module

    when i deploye a ejb module to oc4j_extended_1013_dp4 successfully, it's can't find the file ejb-jar.xml that descript ejb relations and navigators.
    why?
    how can i defense it ?

    however, i repeat my question
    i use two file descript ejb module in MEAT-INF directory, one name ejb-jar.xml , another name orion-ejb-jar.xml
    my ejb jar-package contrained them.
    after deploying , i only find orion-ejb-jar.xml in application-deployments/myapp/myejb

  • EJB relation One to Many - ClassCastException

    Hi !
    I created two CMP EJB entity Client and Address. There is a One to Many relation between them.
    When I deploy them on JBoss, I have no errors, and the correponding tables are created in the database. The EJB seems to work fine, but when I use a 'relation' method : myAddress.setClient(myClient) for instance. I get a ServerException.
    In the log of JBoss there is :
    ClassCastException : org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.SetInstanceValue(...)
    I think I have a problem in my descriptors or JBoss configuration.
    If u have an idea ...
    Thx

    sorry to whack a load of code in but i can't see where the problem is here is my ejb-jar.xml file:
    <ejb-jar>
         <enterprise-beans>
              <entity>
                   <description>This bean represents a copy item.</description>
                   <ejb-name>CopyEJB</ejb-name>
                   <home>com.RemoteCopyHome</home>
                   <remote>com.RemoteCopy</remote>
                   <local-home>com.LocalCopyHome</local-home>
                   <local>com.LocalCopy</local>
                   <ejb-class>com.CopyBean</ejb-class>
                   <persistence-type>Container</persistence-type>
                   <prim-key-class>java.lang.String</prim-key-class>
                   <reentrant>False</reentrant>
                   <cmp-version>2.x</cmp-version>
                   <abstract-schema-name>Copy</abstract-schema-name>
                   <cmp-field>
                        <field-name>copyid</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>quality</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>buyinprice</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>selloutprice</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>bookid</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>title</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>genre</field-name>
                   </cmp-field>
                   <primkey-field>copyid</primkey-field>
                   <security-identity>
                        <description></description>
                        <use-caller-identity></use-caller-identity>
                   </security-identity>
              </entity>
              <entity>
                   <description>This bean represents a supplier.</description>
                   <ejb-name>SupplierEJB</ejb-name>
                   <home>com.RemoteSupplierHome</home>
                   <remote>com.RemoteSupplier</remote>
                   <local-home>com.LocalSupplierHome</local-home>
                   <local>com.LocalSupplier</local>
                   <ejb-class>com.SupplierBean</ejb-class>
                   <persistence-type>Container</persistence-type>
                   <prim-key-class>java.lang.String</prim-key-class>
                   <reentrant>False</reentrant>
                   <cmp-version>2.x</cmp-version>
                   <abstract-schema-name>Supplier</abstract-schema-name>
                   <cmp-field>
                        <field-name>supplierid</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>name</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>address1</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>address2</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>address3</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>address4</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>postcode</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>email</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>telno</field-name>
                   </cmp-field>
                   <primkey-field>supplierid</primkey-field>
                   <security-identity>
                        <description></description>
                        <use-caller-identity></use-caller-identity>
                   </security-identity>
              </entity>
              <entity>
                   <description>This bean represents an edition.</description>
                   <ejb-name>EditionEJB</ejb-name>
                   <home>com.RemoteEditionHome</home>
                   <remote>com.RemoteEdition</remote>
                   <local-home>com.LocalEditionHome</local-home>
                   <local>com.LocalEdition</local>
                   <ejb-class>com.EditionBean</ejb-class>
                   <persistence-type>Container</persistence-type>
                   <prim-key-class>java.lang.String</prim-key-class>
                   <reentrant>False</reentrant>
                   <cmp-version>2.x</cmp-version>
                   <abstract-schema-name>Edition</abstract-schema-name>
                   <cmp-field>
                        <field-name>editionid</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>isbn</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>publisher</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>binding</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>other</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>edition</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>printdate</field-name>
                   </cmp-field>
                   <primkey-field>editionid</primkey-field>
                   <security-identity>
                        <description></description>
                        <use-caller-identity></use-caller-identity>
                   </security-identity>
              </entity>
              <entity>
                   <description>This bean represents an author.</description>
                   <ejb-name>AuthorEJB</ejb-name>
                   <home>com.RemoteAuthorHome</home>
                   <remote>com.RemoteAuthor</remote>
                   <local-home>com.LocalAuthorHome</local-home>
                   <local>com.LocalAuthor</local>
                   <ejb-class>com.AuthorBean</ejb-class>
                   <persistence-type>Container</persistence-type>
                   <prim-key-class>java.lang.String</prim-key-class>
                   <reentrant>False</reentrant>
                   <cmp-version>2.x</cmp-version>
                   <abstract-schema-name>Author</abstract-schema-name>
                   <cmp-field>
                        <field-name>authorid</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>name</field-name>
                   </cmp-field>
                   <primkey-field>authorid</primkey-field>
                   <security-identity>
                        <description></description>
                        <use-caller-identity></use-caller-identity>
                   </security-identity>
              </entity>
              <session>
                   <description>Supplier Function Session Bean</description>
                   <display-name>SupplierFunctionEJB</display-name>
                   <ejb-name>SupplierFunctionEJB</ejb-name>
                   <home>com.SupplierFunctionHome</home>
                   <remote>com.SupplierFunctionRemote</remote>
                   <ejb-class>com.SupplierFunctionSBean</ejb-class>
                   <session-type>Stateless</session-type>
                   <transaction-type>Container</transaction-type>
              </session>
              <session>
                   <description>Copy Function Session Bean</description>
                   <display-name>CopyFunctionEJB</display-name>
                   <ejb-name>CopyFunctionEJB</ejb-name>
                   <home>com.CopyFunctionHome</home>
                   <remote>com.CopyFunctionRemote</remote>
                   <ejb-class>com.CopyFunctionSBean</ejb-class>
                   <session-type>Stateless</session-type>
                   <transaction-type>Container</transaction-type>
              </session>
         </enterprise-beans>
         <relationships>
              <ejb-relation>
                   <ejb-relation-name>Supplier-Copy</ejb-relation-name>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>copy-recievedfrom-supplier</ejb-relationship-role-name>
                        <multiplicity>Many</multiplicity>
                        <cascade-delete></cascade-delete>
                        <relationship-role-source>
                             <ejb-name>CopyEJB</ejb-name>
                        </relationship-role-source>
                        <cmr-field>
                             <cmr-field-name>supplier</cmr-field-name>
                        </cmr-field>
                   </ejb-relationship-role>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>supplier-has-items</ejb-relationship-role-name>
                        <multiplicity>One</multiplicity>
                        <relationship-role-source>
                             <ejb-name>SupplierEJB</ejb-name>
                        </relationship-role-source>
                   </ejb-relationship-role>
              </ejb-relation>
              <ejb-relation>
                   <ejb-relation-name>Edition-Copy</ejb-relation-name>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>edition-has-items</ejb-relationship-role-name>
                        <multiplicity>One</multiplicity>
                        <relationship-role-source>
                             <ejb-name>EditionEJB</ejb-name>
                        </relationship-role-source>
                   </ejb-relationship-role>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>copy-is-a-edition</ejb-relationship-role-name>
                        <multiplicity>Many</multiplicity>
                        <cascade-delete></cascade-delete>
                        <relationship-role-source>
                             <ejb-name>CopyEJB</ejb-name>
                        </relationship-role-source>
                        <cmr-field>
                             <cmr-field-name>edition</cmr-field-name>
                        </cmr-field>
                   </ejb-relationship-role>
              </ejb-relation>
              <!--<ejb-relation>
                   <ejb-relation-name>Author-Copy</ejb-relation-name>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>copy-has-items</ejb-relationship-role-name>
                        <multiplicity>Many</multiplicity>                                     
        <relationship-role-source>
                             <ejb-name>AuthorEJB</ejb-name>
                        </relationship-role-source>
                        <cmr-field>
                             <cmr-field-name>copies</cmr-field-name>
                             <cmr-field-type>java.util.Set</cmr-field-type>
                        </cmr-field>
                   </ejb-relationship-role>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>copy-has-authors</ejb-relationship-role-name>
                        <multiplicity>Many</multiplicity>
                        <cascade-delete></cascade-delete>
                        <relationship-role-source>
                             <ejb-name>CopyEJB</ejb-name>
                        </relationship-role-source>
                        <cmr-field>
                             <cmr-field-name>authors</cmr-field-name>
                     <cmr-field-type>java.util.Set</cmr-field-type>     
                        </cmr-field>
                   </ejb-relationship-role>
              </ejb-relation>-->
         </relationships>
         <assembly-descriptor>
              <security-role>
                   <description>This role represents everyone who is allowed full access
             to the beans.</description>
                   <role-name>Subscribers</role-name>
              </security-role>
              <method-permission>
                   <role-name>Subscribers</role-name>
                   <method>
                        <ejb-name>CopyEJB</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <method>
                        <ejb-name>SupplierEJB</ejb-name>
                        <method-name>*</method-name>
                   </method>
              </method-permission>
              <container-transaction>
                   <method>
                        <ejb-name>CopyEJB</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <method>
                        <ejb-name>SupplierEJB</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <trans-attribute>Required</trans-attribute>
              </container-transaction>
         </assembly-descriptor>
    </ejb-jar>my session bean code can be found at
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=11&t=006578

  • Nonunique ejb-relation-name

    hi all,
    i have a bean that has 2 seperate
    many-many cmrs to the same bean.
    the workbench is creating 2
    ejb-relations with the same name.
    in any case, weblogic.ejbc is giving
    me an error that that ejb-relation-name
    must be unique? i like having the
    workbench maintain the ejb-jar.xml
    file and so i ask if there is anyway to
    bypass this other defining one of the
    relationships by amending the descriptors?
    thanks,
    sean

    just to be clear, this is not a composite.
    the situation is EJBFoo has 2 many-many
    cmrs to EJBBar. my original post wasn't
    quite clear.
    thanks.

  • Problems while defining EJB relations for container managed bean

    I am having a problem while trying to create my relations for my container managed bean.
    My Database schema is:
    Order table
    order_id
    message
    WorkItem table:
    order_id
    item_id
    message
    I have defined my OrderBean to have:
    @LocalMethod()
    @CmrField
    public abstract Collection getCmWorkItemsCmr();
    @LocalMethod()
    public abstract void setCmWorkItemsCmr(Collection workItems);
    I am not sure how to define my relation for my class:
    @Relation(cmrField = "cmWorkItemsCmr", multiplicity = Relation.Multiplicity.MANY, name = "Orders-CmWorkItems")
    An order can have many workitems. I am not sure how to fill in the rest for foreign Key jointable and such.
    Any help pointing me in the right direction would be helpful.
    Thanks,
    Ian

    I am having a problem while trying to create my relations for my container managed bean.
    My Database schema is:
    Order table
    order_id
    message
    WorkItem table:
    order_id
    item_id
    message
    I have defined my OrderBean to have:
    @LocalMethod()
    @CmrField
    public abstract Collection getCmWorkItemsCmr();
    @LocalMethod()
    public abstract void setCmWorkItemsCmr(Collection workItems);
    I am not sure how to define my relation for my class:
    @Relation(cmrField = "cmWorkItemsCmr", multiplicity = Relation.Multiplicity.MANY, name = "Orders-CmWorkItems")
    An order can have many workitems. I am not sure how to fill in the rest for foreign Key jointable and such.
    Any help pointing me in the right direction would be helpful.
    Thanks,
    Ian

  • EJB relation mappings between different ejb jar files.

    I have two local entity EJBs but they are in different ejb jar files. I'd like to make a relationship mapping (one-to-one, one-to-many or whatever) between them. Is it possible? To do that, I need <ejb-name> reference tag each other in both ejb-jar.xml, but how can I refer to ejb-name defined in different ejb jar files? Or as long as you make EJB relationship mappings, all EJBs must be in the same ejb jar file?
    thanks,
    -tom

    Refer to
    http://www.onjava.com/pub/a/onjava/2001/06/26/ejb.html?page=2&x-showcontent=text

  • EJB related question

    Generally speaking, for implementing the business logic we need to develop the EJB.
    I know if one uses the JDeveloper as the web developing tool, he/she does not bother to implement EJB because there is the BC4J.
    But if a developer uses other tools such as Websphere studio, does he/she need to develop the EJB from scatch?
    Or if somebody used Websphere before, is there some better way to implement the business logic if the EJB is not employed?
    Thanks.
    Scott

    Business Logic doesn't have to be in EJB when you develop in Java (doesn't matter which tool you use). In many cases using simple servlets and classes to implement your business logic is good enough and EJB can be an overkill for many tasks.
    For example check out this book:
    http://www.amazon.com/exec/obidos/tg/detail/-/0764558315/002-2811268-1673630?v=glance
    BC4J is a Java framework that among other things simplify writing your business logic for applications that are database driven. It can be deployed as simple classes or as an EJB.
    As far as I know websphere doesn't offer a framework like BC4J and you end up writing a lot more coding manually.

  • Updating deployed EJB definitions

    Hi, all,
    Imagine the following scenario. You develop an EJB webapp and launch it. A few months go by and you enter a significant amount of data into the app's entity beans -- data that is mission-critical and must not be lost in the future under any circumstances.
    Then suddenly the need strikes for you to modify or expand your entity EJBs' class definitions -- say, change some of their fields' types or add totally new fields... How do you then upgrade your EJB class definitions without losing the data that has already been entered into the old definitions, but rather migrating that old object data to your new class definitions? Has anyone had to deal with such a situation in practice?
    To give you an example, suppose our web app has an entity bean class named "ContactPerson" but a few months after deploying the application and creating hundreds of ContactPerson instances we realize we need to associate a new attribute with each one of them -- like their Internet telephony ID. We want to append this new attribute to every existing and future ContactPerson bean instance -- without losing any contact person data the application already contains. Any ideas on how to do this?
    Thanks for any suggestions,
    D. P.

    1) changing and recompiling the EJB classes (to make
    them include new fields),This shouldn't be a problem. It's the usual stuff. The only thing you need to ensure is that all the old fields and their functionality doesn't go off during changing something.
    Still the major part would be the actual DAO stuff... EJBs would not be containing all the backend logic, or is it? Of course, you will need some change in the front-end too, if they are displaying something from the new fields.
    2) updating the back-end database in a way that
    reflects the new object structure but still contains
    the old dataThis can be done by means of loader scripts. And there shouldn't be a problem if you aren't removing any columns or changing their datatypes.
    3) making the new EJB's recognize and work seamlessly
    once again with the new database.This is a question of some testing. I bet you wouldn't be testing on a production box... so why worry about that right now?
    Cheers!
    ***Annie***

  • O/R tool generates invalid ejb-jar.xml for 1-n cmp bean-to-bean relations

    TopLink generates:
    <ejb-relation>
    <ejb-relation-name>Parent-Child</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>Parent-has-childs</ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>Parent</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>childs</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>child-owned-by-Parent</ejb-relationship-role-name>
    <multiplicity>Many</multiplicity>
    <cascade-delete></cascade-delete>
    <relationship-role-source>
    <ejb-name>Child</ejb-name>
    </relationship-role-source>
    </ejb-relationship-role>
    </ejb-relation>
    what's wrong?
    it's missing the following tag:
    '<cmr-field-type>java.util.Collection</cmr-field-type>'
    which should be in the <cmr-field> element after the <cmr-field-name>.
    I cannot get the UI tool to add this tag, whenever I manually add it to the ejb-jar.xml it gets removed the next time I generate the ejb-jar.xml. Additionally, if I try to update the project from the ejb-jar.xml, the O/R tool loses ALL my mappings for entity beans.
    Expected questions:
    TopLink 9.0.3
    WebLogic 7.0.1
    CMP 2.0
    JDK 1.3.1_03
    Yes the getter/setter are defined (on the local interface and bean)
    FYI,
    Andrew

    This should take care of it
    <ejb-jar>
    <enterprise-beans>
    <entity>
    <ejb-name>IDMaster</ejb-name>
    <home>maxateev.mondial.brg.idmaster.IDMasterHome</home>
    <remote>maxateev.mondial.brg.idmaster.IDMaster</remote>
    <local-home>maxateev.mondial.brg.idmaster.IDMasterLocalHome</local-home>
    <local>maxateev.mondial.brg.idmaster.IDMasterLocal</local>
    <ejb-class>maxateev.mondial.brg.idmaster.IDMasterEJB</ejb-class>
    <persistence-type>Container</persistence-type>
    <ejb-local-ref>
    <ejb-ref-name>ejb/IDMasterLocalHome</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <local-home>maxateev.mondial.brg.idmaster.IDMasterLocalHome</local-home>
    <local>maxateev.mondial.brg.idmaster.IDMasterLocal</local>
    </ejb-local-ref>
    <prim-key-class>java.lang.String</prim-key-class>
    <reentrant>False</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>IDMaster</abstract-schema-name>
    <cmp-field>
    <field-name>idPrefix</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>idValue</field-name>
    </cmp-field>
    <primkey-field>idPrefix</primkey-field>
    <ejb-local-ref>
    <ejb-ref-name>ejb/IDMasterLocalHome</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <local-home>maxateev.mondial.brg.idmaster.IDMasterLocalHome</local-home>
    <local>maxateev.mondial.brg.idmaster.IDMasterLocal</local>
    </ejb-local-ref>
    <query>
    <query-method>
    <method-name>findAllIDMasters</method-name>
    <method-params/>
    </query-method>
    <ejb-ql><![CDATA[SELECT OBJECT (f) FROM IDMaster as f]]></ejb-ql>
    </query>
    </entity>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>IDMaster</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>

  • EJB bidirectional relations

    Like in this manual
    http://help.sap.com/saphelp_nw04/helpdata/de/76/c6ba3eb645dc61e10000000a114084/content.htm
    i tried to map EJB-Fields from different EJBs to an existing dictionary. Inside the ejb-jar.xml was the following text:
    <i>    <relationships>
            <ejb-relation>
                <description>description</description>
                <ejb-relation-name>CatDatRelation</ejb-relation-name>
                <ejb-relationship-role>
                    <ejb-relationship-role-name>com.eonis.test.CategoryBean</ejb-relationship-role-name>
                    <multiplicity>Many</multiplicity>
                    <relationship-role-source>
                        <ejb-name>CategoryBean</ejb-name>
                    </relationship-role-source>
                    <cmr-field>
                        <cmr-field-name>catDatRel</cmr-field-name>
                        <cmr-field-type>java.util.Set</cmr-field-type>
                    </cmr-field>
                </ejb-relationship-role>
                <ejb-relationship-role>
                    <ejb-relationship-role-name>com.eonis.test.DataBean</ejb-relationship-role-name>
                    <multiplicity>Many</multiplicity>
                    <relationship-role-source>
                        <ejb-name>DataBean</ejb-name>
                    </relationship-role-source>
                </ejb-relationship-role>
            </ejb-relation>
        </relationships></i>
    How do I the many-to-many-relationship? My Guess was:
    <i>    <relationships>
            <ejb-relation>
                <description>description</description>
                <ejb-relation-name>CatDatRelation</ejb-relation-name>
                <ejb-relationship-role>
                    <ejb-relationship-role-name>com.eonis.test.CategoryBean</ejb-relationship-role-name>
                    <multiplicity>Many</multiplicity>
                    <relationship-role-source>
                        <ejb-name>CategoryBean</ejb-name>
                    </relationship-role-source>
                    <cmr-field>
                        <cmr-field-name>catDatRel</cmr-field-name>
                        <cmr-field-type>java.util.Set</cmr-field-type>
                    </cmr-field>
              <cmr-field>
                        <cmr-field-name>DatCatRel</cmr-field-name>
                        <cmr-field-type>java.util.Set</cmr-field-type>
              </cmr-field>
                </ejb-relationship-role>
                <ejb-relationship-role>
                    <ejb-relationship-role-name>com.eonis.test.DataBean</ejb-relationship-role-name>
                    <multiplicity>Many</multiplicity>
                    <relationship-role-source>
                        <ejb-name>DataBean</ejb-name>
                    </relationship-role-source>
                </ejb-relationship-role>
            </ejb-relation>
        </relationships></i>
    It didn't work. Can anybody help me, please?

    Hi Richard,
    You can only have 0 or 1 cmr-field per ejb-relationship-role. So to make the relationship bidirectional, the second cmr-field should be in the second ejb-relationship-role:
    <i><relationships>
    <ejb-relation>
    <description>description</description>
    <ejb-relation-name>CatDatRelation</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>com.eonis.test.CategoryBean</ejb-relationship-role-name>
    <multiplicity>Many</multiplicity>
    <relationship-role-source>
    <ejb-name>CategoryBean</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>catDatRel</cmr-field-name>
    <cmr-field-type>java.util.Set</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>com.eonis.test.DataBean</ejb-relationship-role-name>
    <multiplicity>Many</multiplicity>
    <relationship-role-source>
    <ejb-name>DataBean</ejb-name>
    </relationship-role-source>
    <b><cmr-field>
    <cmr-field-name>DatCatRel</cmr-field-name>
    <cmr-field-type>java.util.Set</cmr-field-type>
    </cmr-field></b>
    </ejb-relationship-role>
    </ejb-relation>
    </relationships></i>
    Hope that helps,
    Vladimir

  • NPE occurs when deploying suitecase dependent on WSIF / EJB

    I am getting a NullPointerException when deploying a BPEL process that depends on an EJB accessed via a WSIF definition. Both the ejb and the suitcase are deployed onto the same oc4j instance, and i have tested the ejb from a standalone client to ensure that it is operational, but i get the exception noted below. I can only assume that there may be something wrong with the WSIF definition, but I have checked it numerous times to make sure that it accurately reflects the ejb definition. Can you give me some hints as to some things to check that could possibly cause this error? From the stack trace, it seems that it is ejb related, but i guess i could be wrong:
    <2006-04-11 11:20:28,088> <ERROR> <default.collaxa.cube.engine.deployment> <Cube
    ProcessFactory::generateProcessClass>
    Process "XYZ" (revision "1.01.000.0000") compilation failed.
    <2006-04-11 11:20:28,182> <ERROR> <default.collaxa.cube.engine.deployment> <Cube
    ProcessLoader::create>
    <2006-04-11 11:20:28,182> <ERROR> <default.collaxa.cube.engine.deployment> Proce
    ss "XYZ" (revision "1.01.000.0000") load FAILED!!
    com.evermind.server.rmi.OrionRemoteException: java.lang.NullPointerException
    at com.evermind.server.ejb.EJBUtils.getUserException(EJBUtils.java:296)
    at IBPELDomainManagerBean_StatelessSessionBeanWrapper34.loadProcessArchi
    ve(IBPELDomainManagerBean_StatelessSessionBeanWrapper34.java:2174)
    at com.collaxa.cube.engine.deployment.CubeProcessMonitorWork.run(CubePro
    cessMonitorWork.java:130)
    at oracle.tip.adapter.fw.jca.work.WorkerJob.go(WorkerJob.java:51)
    at oracle.tip.adapter.fw.common.ThreadPool.run(ThreadPool.java:267)
    at java.lang.Thread.run(Thread.java:534)
    Nested exception is:
    java.lang.NullPointerException
    at java.util.Hashtable.put(Hashtable.java:398)
    at com.collaxa.cube.engine.deployment.CubeProcessHolder.addStatus(CubePr
    ocessHolder.java:275)
    at com.collaxa.cube.engine.deployment.CubeProcessHolder.bind(CubeProcess
    Holder.java:1240)
    at com.collaxa.cube.engine.deployment.CubeProcessHolder.loadAndBind(Cube
    ProcessHolder.java:882)
    at com.collaxa.cube.engine.deployment.CubeProcessHolder.loadArchive(Cube
    ProcessHolder.java:824)
    at com.collaxa.cube.engine.CubeEngine.loadProcessArchive(CubeEngine.java
    :939)
    at com.collaxa.cube.ejb.impl.BPELDomainManagerBean.loadProcessArchive(BP
    ELDomainManagerBean.java:390)
    at IBPELDomainManagerBean_StatelessSessionBeanWrapper34.loadProcessArchi
    ve(IBPELDomainManagerBean_StatelessSessionBeanWrapper34.java:2157)
    at com.collaxa.cube.engine.deployment.CubeProcessMonitorWork.run(CubePro
    cessMonitorWork.java:130)
    at oracle.tip.adapter.fw.jca.work.WorkerJob.go(WorkerJob.java:51)
    at oracle.tip.adapter.fw.common.ThreadPool.run(ThreadPool.java:267)
    at java.lang.Thread.run(Thread.java:534)
    <2006-04-11 11:20:28,182> <ERROR> <default.collaxa.cube.engine.deployment> <Cube
    ProcessMonitorWork::run> Error while loading process archive C:\OraBpelPM\integr
    ation\orabpel\domains\default\deploy\bpel_XYZ_1.01.000.0000.jar
    com.evermind.server.rmi.OrionRemoteException: java.lang.NullPointerException
    at com.evermind.server.ejb.EJBUtils.getUserException(EJBUtils.java:296)
    at IBPELDomainManagerBean_StatelessSessionBeanWrapper34.loadProcessArchi
    ve(IBPELDomainManagerBean_StatelessSessionBeanWrapper34.java:2174)
    at com.collaxa.cube.engine.deployment.CubeProcessMonitorWork.run(CubePro
    cessMonitorWork.java:130)
    at oracle.tip.adapter.fw.jca.work.WorkerJob.go(WorkerJob.java:51)
    at oracle.tip.adapter.fw.common.ThreadPool.run(ThreadPool.java:267)
    at java.lang.Thread.run(Thread.java:534)
    Nested exception is:
    java.lang.NullPointerException
    at java.util.Hashtable.put(Hashtable.java:398)
    at com.collaxa.cube.engine.deployment.CubeProcessHolder.addStatus(CubePr
    ocessHolder.java:275)
    at com.collaxa.cube.engine.deployment.CubeProcessHolder.bind(CubeProcess
    Holder.java:1240)
    at com.collaxa.cube.engine.deployment.CubeProcessHolder.loadAndBind(Cube
    ProcessHolder.java:882)
    at com.collaxa.cube.engine.deployment.CubeProcessHolder.loadArchive(Cube
    ProcessHolder.java:824)
    at com.collaxa.cube.engine.CubeEngine.loadProcessArchive(CubeEngine.java
    :939)
    at com.collaxa.cube.ejb.impl.BPELDomainManagerBean.loadProcessArchive(BP
    ELDomainManagerBean.java:390)
    at IBPELDomainManagerBean_StatelessSessionBeanWrapper34.loadProcessArchi
    ve(IBPELDomainManagerBean_StatelessSessionBeanWrapper34.java:2157)
    at com.collaxa.cube.engine.deployment.CubeProcessMonitorWork.run(CubePro
    cessMonitorWork.java:130)
    at oracle.tip.adapter.fw.jca.work.WorkerJob.go(WorkerJob.java:51)
    at oracle.tip.adapter.fw.common.ThreadPool.run(ThreadPool.java:267)
    at java.lang.Thread.run(Thread.java:534)

    Note, that this has nothing to do with WSIF.. and is a cmpilation error ...
    my best guess is the revision number..
    Process "XYZ" (revision "1.01.000.0000") load FAILED!! can you change that to reflect a norma double or in (1, 1.1, 2.0...)
    thx clemens

  • Orion-ejb-jar.xml for oc4j and xdoclet

    Does anybody try to use xdoclet to generate orion-ejb-jar.xml with ejb relation?
    Could somebody show me any example of definition relation for xdoclet and orion-ejb-jar.xml? (@orion:persistence...)
    thanks for any advice... :-)
    Zajo

    Hello,
    The warning message looks to be unrelated to the java.lang.IllegalArgumentException error. The warning states that optimistic locking cannot be migrated to the toplink-ejb-jar.xml file; this is stated in chapter 7 of the TopLink developer's guide at
    http://download-west.oracle.com/otn_hosted_doc/toplink/1013/MAIN/_pdf/b13593_v1_01.pdf
    The exception though seems to indicate that your orion-ejb-jar.xml contains EJBs mapped to the same table that are not related through EJB inheritance. I do it all the time with POJOs so this will work in TopLink, but you will need a support case to help get your project migrated if this is the case.
    Best Regards,
    Chris Delahunt

  • Mobile/Handheld client related query

    hello all,
    I have a query regarding handheld/mobile client. Does siebel gateway server come into picture when a mobile/handheld client synchronizes with siebel server? Iff yes then how?
    Thanks

    You're asking lots of questions and some are kind of loaded. But I'll chime in for some of them.
    Web Service
    In .Net I have created WCF services. What is the Java equivalent? Is it EJB?Definitely not EJB. The closest would be web services or RPC
    Data Synchronisation
    .Net has a Sync Framework. Basically it allows you to synchronise data from a main database (usually SQL Server) to a database on the mobile device (usually SQL Server CE). Is there a Java equivalent?My impression is not that this is specifically .NET, or at least not something you have to write code against. It's a service that you buy and deploy, right?
    UI and UI Markup
    The last time I used Java, Swing was what was used. Is that still the case? Is there a Java equivalent of Xaml? Xaml is an Xml like markup language which Microsoft uses for defining UI. It is very useful.There is no xaml equivalent. Swing it is as far as I know.
    Data/Business Layer Utility
    Is there are tool which will allow you to point at a data structure and pump out class files which reflect the database's structure? .Net has something called Entity Framework for this.Sounds like a job for Hibernate or similar ORM tool to me.
    Auto Generation of Web Services
    This is related to the first item Web Service, and the above item. Is there a way to pump out the services services automatically? In .Net I have written libraries that pump out Web Methods for saving, loading and deleting records in each of the tables in the database. Microsoft has something called RIA Architecture for this. Is there an equivalent in Java? I have no comment on this.

  • Weblogic 9.1, EJB 2.0, Oracle 9i: Cascade delete Error

    Hi All,
    I am facing an error with the cascade-delete facility in ejb2.0 with weblogic 9.1
    Assume that I have the following relation:
    <ejb-relation>
    <ejb-relation-name>TeacherEJB-StudentEJB</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>teacher-has-student
    </ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>TeacherEJB</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>teacher</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>student-has-teacher
    </ejb-relationship-role-name>
    <multiplicity>Many</multiplicity>
    <cascade-delete/>
    <relationship-role-source>
    <ejb-name>StudentEJB</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>student</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type><cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    Now when I have to delete one record from the DBSTUDENT table, what i do is the following:
    StudentHomeLocal.remove(studentModel.getStudentId());
    The above statement throws an SQLException staying it can't update TeacherID in DBSTUDENT (PK of DBTEACHER, FK in DBSTUDENT) with NULL.
    The same code is working perfectly well in Weblogic 8.
    I even tried deleting the local directly by the following statement:
    StudentLocal.remove();
    But this too doesn't work.
    I also tried by removing the <cascade-delete/> attribute from the ejb-jar.xml file and updating the 'on-delete cascade' option in the database, but this too did not work.
    There is another option of <db-cascade-delete> in weblogic-cmp-rdbms-jar.xml that I tried but this too did not work.
    In short, I have tried the following cases but to no avail:
    1. Mention cascade delete in ejb-jar.xml and nothing mentioned in weblogic-cmp-rdbms-jar.xml.jar and in the database.
    2. Mention nothing in ejb-jar.xml and nothing mentioned in weblogic-cmp-rdbms-jar.xml.jar but 'on cascade delete' mentioned in the database.
    3. Mention cascade delete in ejb-jar.xml and db-cascade-delete mentioned in weblogic-cmp-rdbms-jar.xml.jar and 'on cascade delete' in the database.
    4. Remove all cascade delete from the ejb-jar.xml,the weblogic-cmp-rdbms-jar.xml and from the database.
    Neither of the above work.
    Kindly help ASAP.
    Thanks in advance,
    Sachidanand.

    Hi All,
    I am facing an error with the cascade-delete facility in ejb2.0 with weblogic 9.1
    Assume that I have the following relation:
    <ejb-relation>
    <ejb-relation-name>TeacherEJB-StudentEJB</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>teacher-has-student
    </ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>TeacherEJB</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>teacher</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>student-has-teacher
    </ejb-relationship-role-name>
    <multiplicity>Many</multiplicity>
    <cascade-delete/>
    <relationship-role-source>
    <ejb-name>StudentEJB</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>student</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type><cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    Now when I have to delete one record from the DBSTUDENT table, what i do is the following:
    StudentHomeLocal.remove(studentModel.getStudentId());
    The above statement throws an SQLException staying it can't update TeacherID in DBSTUDENT (PK of DBTEACHER, FK in DBSTUDENT) with NULL.
    The same code is working perfectly well in Weblogic 8.
    I even tried deleting the local directly by the following statement:
    StudentLocal.remove();
    But this too doesn't work.
    I also tried by removing the <cascade-delete/> attribute from the ejb-jar.xml file and updating the 'on-delete cascade' option in the database, but this too did not work.
    There is another option of <db-cascade-delete> in weblogic-cmp-rdbms-jar.xml that I tried but this too did not work.
    In short, I have tried the following cases but to no avail:
    1. Mention cascade delete in ejb-jar.xml and nothing mentioned in weblogic-cmp-rdbms-jar.xml.jar and in the database.
    2. Mention nothing in ejb-jar.xml and nothing mentioned in weblogic-cmp-rdbms-jar.xml.jar but 'on cascade delete' mentioned in the database.
    3. Mention cascade delete in ejb-jar.xml and db-cascade-delete mentioned in weblogic-cmp-rdbms-jar.xml.jar and 'on cascade delete' in the database.
    4. Remove all cascade delete from the ejb-jar.xml,the weblogic-cmp-rdbms-jar.xml and from the database.
    Neither of the above work.
    Kindly help ASAP.
    Thanks in advance,
    Sachidanand.

  • Local Session Bean calling another local Session Bean in EJB 3.0

    Hi,
    In EJB 3.0, I am trying to do JNDI lookup of a local sesion bean from another session bean's helper class.
    I am not using @EJB injection mechanism here, as call to the local session bean is made in a helper class. Helper classes do not support resource injection.
    Following are the EJB class definitions used in my project. Call to "EJB3Local" made from "EJB1" fails as the "EJB2" helper class is calling "EJB1Local"
    @Stateless
    @EJBs({@EJB(name="EJB2Local", beanInterface=EJB2Local.class),
    @EJB(name="EJB3Local", beanInterface=EJB3Local.class)})
    public class EJB1 implements EJB1Remote, EJB1Local{
    public void findEJB3Local(){
    //1. JNDI lookup for EJB3Local ----
    //2. EJB3Local.someFunction()
    @Stateless
    @EJB(name="EJB1Local", beanInterface=EJB1Local.class)
    public class EJB2 implements EJB2Remote, EJB2Local{
    public void findEJB1Local(){
    //1. JNDI lookup EJB1Local
    // 2. Call EJB1Local.findEJB1Local method
    @Stateless
    public class EJB3 implements EJB3Remote, EJB3Local{
    public void someFunction(){}
    A remote call to EJB2.findEJB1Local() will invoke EJb1Local.findEJB3Local method and the call fails with "java:comp/env/EJB3Local" not found in EJB1Local.
    Has anybody encountered an issue like this issue with local interface calling another local interface?
    Thanks,
    Mohan

    To refer a Ejb from another Ejb include <ejb-ref> element
    in ejb-jar.xml
    <session>
    <ejb-name>SessionBeanA</ejb-name>
    <ejb-ref>
    <ejb-ref-name>SessionBeanB</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.ejb.SessionBeanBHome</home>
    <remote>com.ejb.SessionBeanB</remote>
    </ejb-ref>
    </session>
    Include a <reference-descriptor> in weblogic-ejb-jar.xml
    <weblogic-enterprise-bean>
    <ejb-name>SessionBeanA</ejb-name>
    <reference-descriptor>
    <ejb-reference-description>
    <ejb-ref-name>SessionBeanB</ejb-ref-name>
    <jndi-name>com.ejb.SessionBeanBHome</jndi-name>
    </ejb-reference-description>
    </reference-descriptor>
    </weblogic-enterprise-bean>
    In SessionBeanA Bean class refer to SessionBeanB with
    a remote reference to SessionBeanB.
    InitialContext initialContext=new InitialContext();
    SessionBeanBHome sessionBeanBHome=(SessionBeanBHome)
    initialContext.lookup("com.ejb.SessionBeanBHome");
    SessionBeanB sessionBeanB=sessionBeanBHome.findByPrimaryKey(primarykey);
    sessionBeanB.update();
    sessionBeanB.getAll();
    thanks,
    Deepak

Maybe you are looking for

  • Outlook 2011 for Mac Preferences not displaying properly

    I have 2 emails set up in my outlook, one of them was a work email for a company I am no longer working for. They have cancelled my email but I am unable to pull up the accounts section of my outlook preferences to remove the account. When I open pre

  • FOP PDF Printing Fails with 500 Internal Server Error in APEX 4.1

    Hi, We have Oracle Application Server 10.1.3.5 (Apache + J2ee) installation in our environment. I configured Apache FOP for Apex 4.1 running on Oracle 11.2.0.1 database using" Section 5 - Installing and Configuring Apache FOP - http://www.oracle.com/

  • Frameset browse problem in DW CS3

    In DW CS3, if I try to browse locally, a CFM file containing a frameset, my browser opens with the PHYSICAL path of the file instead of the localhost web url, and so the file is not parsed and I see only HTML/CFML. This does NOT happen with CFM files

  • What headphone/mic set will work with BB

    I hate the headphones that come the the bb, they are uncomfortable, don't fit the ear properly and the sound quality is crap, as for the microphone, people tell me it sounds of static and is distorted. Today the clip broke as well. I have to use hand

  • DME configuration for payment Media (FI-CA payment program)

    Hi all, I need to change the standard entry class code in the batch header (batch is created by the programs SAPFKPY3 and RFKPYL00_MASS). Currently the batch header is PPD (for consumer and business). I need to modify it like- PPD for consumer and CC