EJB CMR relationship causes SystemException

I have two CMP entities called Employee and Department. I created a one-to-many relationship between them so many employees can belong to a department. I also created
a new ejbCreate() method that accepts a value object containing the employee details and the PK of the relevant department to create them in, which is a Long.
In my ejbCreate() method I set the fields of the Employee entity
In the ejbPostCreate() method, I lookup the relevant Department local home (which works fine), but on the following line where I do a home.findByPrimaryKey() passing in the correct Long value identifiying an existing employee I get the following:
'SystemException  in the resource system.' is thrown during the execution of the findByPrimaryKey method, which causes a subsequent CreateException.
I've stepped through in the debugger but can't seem to find out the cause, and there is not much information from the message to follow up on.
Can anyone suggest an answer?
I've attached the stack dump below, and you will notice I have replaced my findByPrimaryKey() with findByDepartmentName(..) to see if it affected the result, but it still fails with the same problem. I know findByDepartmentName(..) works OK as I have exposed it as a web service and it functions as expected.
[code]com.sap.engine.services.ejb.exceptions.BaseEJBException: SystemException  in the resource system.
     at com.axonglobal.test.ejb.DepartmentLocalHomeImpl0.findByDepartmentName(DepartmentLocalHomeImpl0.java:920)
     at com.axonglobal.test.ejb.Employee2Bean.ejbPostCreate(Employee2Bean.java:110)
     at com.axonglobal.test.ejb.Employee2LocalHomeImpl0.create(Employee2LocalHomeImpl0.java:608)
     at com.axonglobal.test.ejb.FacadeBean.createEmployee(FacadeBean.java:130)
     at com.axonglobal.test.ejb.FacadeObjectImpl0.createEmployee(FacadeObjectImpl0.java:259)
     at com.axonglobal.test.ejb.Facade_Stub.createEmployee(Facade_Stub.java:154)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:324)
     at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187)
     at $Proxy76.createEmployee(Unknown Source)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:324)
     at com.sap.engine.services.webservices.runtime.EJBImplementationContainer.invokeMethod(EJBImplementationContainer.java:126)
     at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:146)
     at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:68)
     at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPost(ServletDispatcherImpl.java:92)
     at SoapServlet.doPost(SoapServlet.java:51)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)
     at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)
     at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)
     at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)
     at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)
     at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)
     at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
     at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)
     at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
     at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
     at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
     at java.security.AccessController.doPrivileged(Native Method)
     at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
     at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
Caused by: com.sap.engine.services.connector.exceptions.BaseResourceContextException: The last entered method is "Persistence_manager_methods_using_transactional_connection", but exit method is "com.axonglobal.test.ejb.DepartmentLocalHomeImpl0.findByDepartmentName(java.lang.String)".
     at com.sap.engine.services.connector.resource.impl.ResourceContextImpl.exitMethod(ResourceContextImpl.java:124)
     at com.axonglobal.test.ejb.DepartmentLocalHomeImpl0.findByDepartmentName(DepartmentLocalHomeImpl0.java:917)
     ... 36 more
com.sap.engine.services.connector.exceptions.BaseResourceContextException: The last entered method is "Persistence_manager_methods_using_transactional_connection", but exit method is "com.axonglobal.test.ejb.DepartmentLocalHomeImpl0.findByDepartmentName(java.lang.String)".
     at com.sap.engine.services.connector.resource.impl.ResourceContextImpl.exitMethod(ResourceContextImpl.java:124)
     at com.axonglobal.test.ejb.DepartmentLocalHomeImpl0.findByDepartmentName(DepartmentLocalHomeImpl0.java:917)
     at com.axonglobal.test.ejb.Employee2Bean.ejbPostCreate(Employee2Bean.java:110)
     at com.axonglobal.test.ejb.Employee2LocalHomeImpl0.create(Employee2LocalHomeImpl0.java:608)
     at com.axonglobal.test.ejb.FacadeBean.createEmployee(FacadeBean.java:130)
     at com.axonglobal.test.ejb.FacadeObjectImpl0.createEmployee(FacadeObjectImpl0.java:259)
     at com.axonglobal.test.ejb.Facade_Stub.createEmployee(Facade_Stub.java:154)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:324)
     at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187)
     at $Proxy76.createEmployee(Unknown Source)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:324)
     at com.sap.engine.services.webservices.runtime.EJBImplementationContainer.invokeMethod(EJBImplementationContainer.java:126)
     at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:146)
     at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:68)
     at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPost(ServletDispatcherImpl.java:92)
     at SoapServlet.doPost(SoapServlet.java:51)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)
     at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)
     at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)
     at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)
     at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)
     at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)
     at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
     at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)
     at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
     at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
     at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
     at java.security.AccessController.doPrivileged(Native Method)
     at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
     at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)[/code]

Hi Steve,
What is the SP number (or Patch Level) of your J2EE Engine?
Just a small hint: you can lookup the DepartmentLocalHome in the setEntityContext() method of EmployeeBean - this will boost performance as it'll be invoked only once per bean instance.
Best regards,
Vladimir

Similar Messages

  • Ejb,cmr many to one

    hi,
    i have two tables department and employee.The employee table contains the foreign key dept_id.When i am trying to insert it doesnot insert the foreign key in the Employee table.Can anyone give an example program along with the ejb-jar.xml and sun-cmp-mappings.xml file
    thank u

    This is the excerpt of ejb-jar.xml:
    <ejb-jar>
    <relationships>
    <description>Department-Employee</description>
    <ejb-relation>
    <description>Department-Employee</description>
    <ejb-relation-name></ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>DepartmentEJB</ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>DepartmentEJB</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>employees</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>EmployeeEJB</ejb-relationship-role-name>
    <multiplicity>Many</multiplicity>
    <cascade-delete />
    <relationship-role-source>
    <ejb-name>EmployeeEJB</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>department</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    </relationships>
    </ejb-jar>
    This is the excerpt from sun-cmp-mappings.xml:
    <sun-cmp-mappings>
    <sun-cmp-mapping>
    <entity-mapping>
    <ejb-name>DepartmentEJB</ejb-name>
    <table-name>DEPARTMENT</table-name>
    <cmr-field-mapping>
    <cmr-field-name>employees</cmr-field-name>
    <column-pair>
    <column-name>DEPARTMENT.ID</column-name>
    <column-name>EMPLOYEE.DEPT_ID</column-name>
    </column-pair>
    </cmr-field-mapping>
    </entity-mapping>
    <entity-mapping>
    <ejb-name>EmployeeEJB</ejb-name>
    <table-name>EMPLOYEE</table-name>
    <cmr-field-mapping>
    <cmr-field-name>department</cmr-field-name>
    <column-pair>
    <column-name>EMPLOYEE.DEPT_ID</column-name>
    <column-name>DEPARTMENT.ID</column-name>
    </column-pair>
    </cmr-field-mapping>
    </entity-mapping>
    </sun-cmp-mapping>
    </sun-cmp-mappings>
    Both excerpts show only the parts relevant to the relationship btw. employee-department.

  • Testing some topological relationships causes 01331

    Hi Dan,
    Per your request, I post the following files/commands hoping you may recreate the problems I reported in my earlier post - Test EQUAL relationship causes 01331.
    In a nutshell, some topological testing functions/operators fail at certain tolerance at which all geometry involved appears valid. These functions/operations work just fine with a smaller tolerance; however, our business process requires maintaining the higher tolerance. We are using version 8.1.7.
    In the data set, the problem relationships are EQUAL, DISJOINT, TOUCH, and OVERLAPBDYINTERSECT.
    ****************** BO_PARCEL_TEST.PRE *******************
    CREATE TABLE BO_PARCEL_TEST (
    ID NUMBER(10,0) PRIMARY KEY ,
    SPATIALAREA MDSYS.SDO_GEOMETRY,
    APN VARCHAR2(12) );
    ****************** BO_PARCEL_TEST.CTL *******************
    LOAD DATA
    INFILE 'BO_PARCEL_TEST.Dat'
    APPEND INTO TABLE BO_PARCEL_TEST
    FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    ID,
    SPATIALAREA COLUMN OBJECT
    ( sdo_gtype INTEGER EXTERNAL,
    sdo_srid INTEGER EXTERNAL,
    isnull FILLER CHAR,
    SDO_POINT COLUMN OBJECT NULLIF SPATIALAREA.isnull="pt"
    ( X INTEGER EXTERNAL,
    Y INTEGER EXTERNAL,
    Z INTEGER EXTERNAL),
    SDO_ELEM_INFO VARRAY terminated by ';'
    (SDO_ORDINATES char(38)),
    SDO_ORDINATES VARRAY terminated by ':'
    (SDO_ORDINATES char(38))) ,
    APN )
    ****************** BO_PARCEL_TEST.DAT *******************
    442|2003| |pt||||1|1003|1|13|2003|1|;592793.23941115045|888840.48031548457|591541.12791537843|888828.71933900658|591539.74891813647|888729.31353781873|592164.95766771643|888736.11952420673|592793.31541099853|888742.53151138267|592793.23941115045|888840.48031548457|592478.28504106042|888823.45034954476|592478.28504106042|888753.96548851475|592302.76239210647|888753.96548851475|592302.76239210647|888823.45034954476|592478.28504106042|888823.45034954476|:"101-05-004"|
    443|2003| |pt||||1|1003|1|;592302.76239210647|888823.45034954476|592302.76239210647|888753.96548851475|592478.28504106042|888753.96548851475|592478.28504106042|888823.45034954476|592302.76239210647|888823.45034954476|:"101-05-500"|
    444|2003| |pt||||1|1003|1|;594106.22078518244|888853.67028910469|594069.36585889244|888853.31228982075|592793.23941115045|888840.48031548457|592793.31541099853|888742.53151138267|592793.60541041847|888369.50625743461|592794.21840919252|887583.53582937864|592794.24440914043|887566.53586337867|593037.37992286845|887567.94286056457|593067.37886287039|887568.11686021672|593097.3788028704|887568.2898598708|593097.44280274247|887596.27380390279|594109.35077892244|887601.84479276079|594106.22078518244|888853.67028910469|:"101-05-001H"|
    445|2003| |pt||||1|1003|1|;592164.95766771643|888736.11952420673|591539.74891813647|888729.31353781873|591526.62294438842|888729.17053810472|591526.68694426049|888597.46080152469|592164.95766771643|888601.39879364858|592164.95766771643|888736.11952420673|:"101-05-003"|
    446|2003| |pt||||1|1003|1|;592793.31541099853|888742.53151138267|592164.95766771643|888736.11952420673|592164.95766771643|888601.39879364858|591526.68694426049|888597.46080152469|591527.02194359037|888361.26927390869|592175.63064637047|888365.29626585462|592793.60541041847|888369.50625743461|592793.31541099853|888742.53151138267|:"101-05-002F"|
    448|2003| |pt||||1|1003|1|;592175.63064637047|888365.29626585462|591527.02194359037|888361.26927390869|591527.02194359037|887911.27017390856|592175.63064637047|887911.50117344677|592175.63064637047|888365.29626585462|:"101-05-002J"|
    450|2003| |pt||||1|1003|1|;592793.60541041847|888369.50625743461|592175.63064637047|888365.29626585462|592175.63064637047|887911.50117344677|592175.63064637047|887579.95683653676|592794.21840919252|887583.53582937864|592793.60541041847|888369.50625743461|:"101-05-002M"|
    452|2003| |pt||||1|1003|1|;592175.63064637047|887911.50117344677|591527.02194359037|887911.27017390856|591527.18594326242|887576.20484404068|591546.61190441041|887576.31684381666|592175.63064637047|887579.95683653676|592175.63064637047|887911.50117344677|:"101-05-002L"|
    454|2003| |pt||||1|1003|1|;592794.21840919252|887583.53582937864|592175.63064637047|887579.95683653676|591546.61190441041|887576.31684381666|591547.70490222448|887036.24992395274|591777.70444222447|887036.56592332071|591949.90409782447|887036.80292284663|593037.89992182842|887038.30491984263|593037.37992286845|887567.94286056457|592794.24440914043|887566.53586337867|592794.21840919252|887583.53582937864|:"101-05-008"|
    455|2003| |pt||||1|1003|1|;594109.35077892244|887601.84479276079|593097.44280274247|887596.27380390279|593097.3788028704|887568.2898598708|593097.98180166446|886954.12708819867|593156.1516853245|886954.10208824871|593156.18268526252|887024.1019482488|593286.59142444446|887024.04494836263|593286.58342446049|887004.04498836282|593311.58337446046|887004.03398838465|593311.57237448252|886979.03403838468|593361.57227448246|886979.01203842857|593361.57227448246|887328.32133980875|593777.2104432045|887328.29233986675|593777.01444359648|887233.62252920668|593736.58552445448|887233.25752993673|593735.77052608447|886953.84908875474|593621.56075450452|886953.89908865467|593621.5947544364|886672.12965219468|593621.61175440252|886532.26993191463|593098.3958008365|886532.49793145864|593098.61880039051|886305.39338566875|594110.56477649452|886306.78438288672|594112.58977244445|886306.78738288069|594110.56477649452|887116.43876357458|594109.35077892244|887601.84479276079|:"101-05-001L"|
    456|2003| |pt||||1|1003|1|;593361.57227448246|887328.32133980875|593361.57227448246|886979.01203842857|593361.56127450441|886954.0120884286|593621.56075450452|886953.89908865467|593735.77052608447|886953.84908875474|593736.58552445448|887233.25752993673|593777.01444359648|887233.62252920668|593777.2104432045|887328.29233986675|593361.57227448246|887328.32133980875|:"101-05-001M"|
    457|2003| |pt||||1|1003|1|;593156.18268526252|887024.1019482488|593156.1516853245|886954.10208824871|593097.98180166446|886954.12708819867|593098.3958008365|886532.49793145864|593621.61175440252|886532.26993191463|593621.5947544364|886672.12965219468|593621.56075450452|886953.89908865467|593361.56127450441|886954.0120884286|593361.57227448246|886979.01203842857|593311.57237448252|886979.03403838468|593311.58337446046|887004.03398838465|593286.58342446049|887004.04498836282|593286.59142444446|887024.04494836263|593156.18268526252|887024.1019482488|:"101-05-001J"|
    458|2003| |pt||||1|1005|6|1|2|1|5|2|1|11|2|2|15|2|1|17|2|2|21|2|1|;593037.89992182842|887038.30491984263|591949.90409782447|887036.80292284663|591950.58809645649|886538.80391884665|591950.9100958124|886303.79738886072|592988.61702039442|886305.22438600659|593019.17695927445|886335.26132593281|593020.65682434675|886361.81861740223|593023.05990207649|886388.30833141052|593034.26805047621|886491.80608356756|593037.35580332961|886530.00526668108|593038.36092090642|886568.31585982279|593037.89992182842|887038.30491984263|:"101-05-005"|
    459|2003| |pt||||1|1003|1|;591949.90409782447|887036.80292284663|591777.70444222447|887036.56592332071|591778.38944085443|886538.56791931868|591950.58809645649|886538.80391884665|591949.90409782447|887036.80292284663|:"101-05-006"|
    460|2003| |pt||||1|1003|1|;591777.70444222447|887036.56592332071|591547.70490222448|887036.24992395274|591549.10789941845|886343.24830995861|591589.19081925252|886303.30038985459|591950.9100958124|886303.79738886072|591950.58809645649|886538.80391884665|591778.38944085443|886538.56791931868|591777.70444222447|887036.56592332071|:"101-05-007"|
    ****************** SQLLOADER COMMAND *******************
    SQLLDR xxx/yyy@zzzz CONTROL=BO_PARCEL_TEST DATA=BO_PARCEL_TEST
    ****************** BO_PARCEL_TEST.POS *******************
    insert into USER_SDO_GEOM_METADATA values('BO_PARCEL_TEST', 'SPATIALAREA' ,MDSYS.SDO_DIM_ARRAY( MDSYS.SDO_DIM_ELEMENT('X', 232850, 993600, 0.05), MDSYS.SDO_DIM_ELEMENT('Y', 526000, 1134000, 0.005)), NULL );
    Commit;
    ****************** BO_PARCEL_TEST.SQL *******************
    Connect xx/yyy@zzz
    set serveroutput on;
    DECLARE
         pv_diminfo_cp MDSYS.USER_SDO_GEOM_METADATA.DIMINFO%TYPE;
         v_rowcount BINARY_INTEGER;
         i NUMBER;
    BEGIN
         -- EQUAL relate succeeds at 0.03 tolerance,
         pv_diminfo_cp := MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X', 232850, 993600, 0.03), MDSYS.SDO_DIM_ELEMENT('Y', 526000, 1134000, 0.03));
         SELECT count(1) INTO v_rowcount
              FROM BO_PARCEL_TEST O, BO_PARCEL_TEST N
              WHERE O.APN = N.APN
              AND SDO_GEOM.RELATE(O.SPATIALAREA, pv_diminfo_cp, 'EQUAL', N.SPATIALAREA,pv_diminfo_cp ) = 'FALSE';
         -- EQUAL relate fails (01331) at 0.05 tolerance,
         pv_diminfo_cp := MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X', 232850, 993600, 0.05), MDSYS.SDO_DIM_ELEMENT('Y', 526000, 1134000, 0.05));
         SELECT count(1) INTO v_rowcount
              FROM BO_PARCEL_TEST O, BO_PARCEL_TEST N
              WHERE O.APN = N.APN
              AND SDO_GEOM.RELATE(O.SPATIALAREA, pv_diminfo_cp, 'EQUAL', N.SPATIALAREA,pv_diminfo_cp ) = 'FALSE';
         -- The following statement shows parcel with ID = 455 is the sore thumb at tolerance 0.05
         FOR i IN 440..460 LOOP
         SELECT COUNT(1) INTO v_rowcount
         FROM BO_PARCEL_TEST O, BO_PARCEL_TEST N
         WHERE O.APN = N.APN
         AND SDO_GEOM.RELATE(O.SPATIALAREA, pv_diminfo_cp, 'EQUAL', N.SPATIALAREA,pv_diminfo_cp ) = 'FALSE'
         AND N.id = i
    --     AND N.id <> 455 -- -- NOTE: if ID 455 is not exluded at 0.05 tolerance, ORA-03113 occurs
         END LOOP;
    END;

    Hi,
    I was able to reproduce the problem in 8.1.7 only. It is fixed in 9.0.1.4/9.2.0.1.
    Dan

  • EJB-QL with CMR relationship

    I have the following:-
    COUNTRY has 1-M relationship with its NCAs (members).
    I want to get all the Members for a given country, so can you please scan through the descriptors and let me know where I a missing something.
    ejb-jar.xml:
    COUNTRY:-
    <entity>
    <description>Entity Bean ( CMP )</description>
    <display-name>Country</display-name>
    <ejb-name>Country</ejb-name>
    <local-home>inspections.ejb.entity.CountryLocalHome</local-home>
    <local>inspections.ejb.entity.CountryLocal</local>
    <ejb-class>inspections.ejb.entity.CountryBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.Long</prim-key-class>
    <reentrant>False</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>Country</abstract-schema-name>
    <cmp-field>
    <field-name>pkCountry</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>ecdDn</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>active</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>countryCode</field-name>
    </cmp-field>
    <primkey-field>pkCountry</primkey-field>
    </entity>
    NCA:-
    <entity>
    <description>Entity Bean ( CMP )</description>
    <display-name>NCA</display-name>
    <ejb-name>NCA</ejb-name>
    <local-home>inspections.ejb.entity.NCALocalHome</local-home>
    <local>inspections.ejb.entity.NCALocal</local>
    <ejb-class>inspections.ejb.entity.NCABean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.Long</prim-key-class>
    <reentrant>False</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>NCA</abstract-schema-name>
    <cmp-field>
    <field-name>pkNca</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>ecdDn</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>active</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>cmrMemberState</field-name>
    </cmp-field>
    <primkey-field>pkNca</primkey-field>
    <query>
    <query-method>
    <method-name>findAll</method-name>
    <method-params/>
    </query-method>
    <ejb-ql>select object(o) from NCA o</ejb-ql>
    </query>
    <query>
    <description>This finds the NCA based on given country</description>
    <query-method>
    <method-name>findNCAByCountry</method-name>
    <method-params>
    <method-param>java.lang.Long</method-param>
    </method-params>
    </query-method>
    <ejb-ql>select object(o) from NCA o, IN (o.cmrMemberState) AS cmr where cmr.pkCountry = ?1</ejb-ql>
    </query>
    </entity>
    ================================================
    orion-ejb-jar.xml
    COUNTRY:-
    <entity-deployment name="Country" data-source="jdbc/DBCorporate" table="CORE.COUNTRY" copy-by-value="false" exclusive-write-access="false">
    <primkey-mapping>
    <cmp-field-mapping name="pkCountry" persistence-name="PK_COUNTRY" persistence-type="NUMBER(10)"/>
    </primkey-mapping>
    <cmp-field-mapping name="pkCountry" persistence-name="PK_COUNTRY" persistence-type="NUMBER(10)"/>
    <cmp-field-mapping name="ecdDn" persistence-name="ECD_DN" persistence-type="VARCHAR2(4000)"/>
    <cmp-field-mapping name="countryCode" persistence-name="COUNTRY_CODE" persistence-type="VARCHAR2(2)"/>
    <cmp-field-mapping name="NCA_cmrMemberState">
    <collection-mapping table="CORE.NCA">
    <primkey-mapping>
    <cmp-field-mapping>
    <entity-ref home="Country">
    <cmp-field-mapping name="cmrMemberState_pkMs" persistence-name="FK_COUNTRY" persistence-type="NUMBER(10)"/>
    </entity-ref>
    </cmp-field-mapping>
    </primkey-mapping>
    <value-mapping type="inspections.ejb.entity.NCALocal" immutable="true">
    <cmp-field-mapping>
    <entity-ref home="NCA">
    <cmp-field-mapping name="pkNca" persistence-name="PK_NCA" persistence-type="NUMBER(10)"/>
    </entity-ref>
    </cmp-field-mapping>
    </value-mapping>
    </collection-mapping>
    </cmp-field-mapping>
    <entity-deployment>
    NCA:-
    <entity-deployment name="NCA" data-source="jdbc/DBCorporate" table="CORE.NCA" copy-by-value="false" exclusive-write-access="false">
    <primkey-mapping>
    <cmp-field-mapping name="pkNca" persistence-name="PK_NCA" persistence-type="NUMBER(10)"/>
    </primkey-mapping>
    <cmp-field-mapping name="pkNca" persistence-name="PK_NCA" persistence-type="NUMBER(10)"/>
    <cmp-field-mapping name="ecdDn" persistence-name="ECD_DN" persistence-type="VARCHAR2(4000)"/>
    <cmp-field-mapping name="cmrMemberState" persistence-name="FK_COUNTRY">
    <entity-ref home="Country">
    <cmp-field-mapping persistence-name="FK_COUNTRY" persistence-type="NUMBER(10)"/>
    </entity-ref>
    <entity-deployment>
    ============================================================
    DEPLOY ERROR:-
    05/08/24 11:20:18 Auto-deploying - inspections-EJB.jar (No previous deployment found)...
    05/08/24 11:20:25 Encountered "IN ( o . cmrMemberState" at line 1, column 13.
    Was expecting one of:
    "AbstractSchemaName" ...
    "IN" "(" "IdentificationVar" "." "SingleValuedCmrField" ...
    "IN" "(" "IdentificationVar" "." "CollectionValuedCmrField" ...
    EJB QL statement : 'select object(o) from NCA o, IN (o.cmrMemberState) AS cmr where cmr.pkCountry = ?1'
    EJB QL method : public abstract java.util.Collection inspections.ejb.entity.NCALocalHome.findNCAByCountry(java.lang.Long) throws javax.ejb.FinderException

    OC4J used is 10g

  • Foreign key in many to one relationship causes redunency

    Hi
    suppose I have two tables
    A and B
    Table A has a primary key A_PK number
    Table B has a primary key B_PK number
    The relation between two tables is M to One
    if B_PK is foreign key on table A
    then it causes redunency
    A_PK B_PK
    1 1
    2 1
    so what the best way to solve like this problem?
    thanks

    VANPERSIE wrote:
    Hi
    suppose I have two tables
    A and B
    Table A has a primary key A_PK number
    Table B has a primary key B_PK number
    The relation between two tables is M to One
    if B_PK is foreign key on table A
    then it causes redunency
    A_PK B_PK
    1 1
    2 1
    so what the best way to solve like this problem?
    thanksIt's not sure from your description exactly how/where/what columns are involved in the FK relationship. You either have no problem, or your problem is that you have two tables with the same PK, meaning you haven't normalized your design.
    As suggested, post actual table defs, not just a vague description.

  • NullPointerException thrown when using get method in CMR relationship outsi

    We are using weblogic 9.1 CMP entity beans with BEA's XA oracle driver. We have a bean called User that has a many address beans. When calling the getAddresses method on a UserLocal a NullPointerException gets thrown if the stateless session bean method that is marked as @LocalMethod(transactionAttribute=Constants.TransactionAttribute.SUPPORTS). If we change it to REQUIRED the method returns addresses successfully. Does anyone have any ideas as to what could be causing this? Below is the stack trace.
    My best guess is that an exception is occurring and when weblogic tries to handle the exception EJBRuntimeUtils.throwEJBException encounters the NullPointerException.
    javax.ejb.EJBException: EJB Exception: : java.lang.NullPointerException
    at gov.nasa.echo.dataaccessobjects.user.echo_user_User_l47u68__WebLogic_CMP_RDBMS_addresses_Set.<init>(echo_user_User_l47u68__WebLogic_CMP_RDBMS_addresses_Set.java
    :93)
    at gov.nasa.echo.dataaccessobjects.user.echo_user_User_l47u68__WebLogic_CMP_RDBMS.getAddresses(echo_user_User_l47u68__WebLogic_CMP_RDBMS.java:1161)
    at gov.nasa.echo.dataaccessobjects.user.echo_user_User_l47u68_ELOImpl.getAddresses(echo_user_User_l47u68_ELOImpl.java:770)
    at gov.nasa.echo.subsystems.user.UserTypeMap.convertUser(UserTypeMap.java:66)
    at gov.nasa.echo.subsystems.user.UserSubsystem.getUserByUserId(UserSubsystem.java:321)
    at gov.nasa.echo.subsystems.user.UserSubsystem.getUsersByUserId(UserSubsystem.java:302)
    at gov.nasa.echo.services.authentication.AuthenticationServiceBean.login(AuthenticationServiceBean.java:442)
    at gov.nasa.echo.services.authentication.AuthenticationServiceBean_plcr77_ELOImpl.login(AuthenticationServiceBean_plcr77_ELOImpl.java:1001)
    at gov.nasa.echo.v8.AuthenticationServicePortImpl.login(AuthenticationServicePortImpl.java:105)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at weblogic.wsee.component.pojo.JavaClassComponent.invoke(JavaClassComponent.java:91)
    at weblogic.wsee.ws.dispatch.server.ComponentHandler.handleRequest(ComponentHandler.java:68)
    at weblogic.wsee.handler.HandlerIterator.handleRequest(HandlerIterator.java:127)
    at weblogic.wsee.ws.dispatch.server.ServerDispatcher.dispatch(ServerDispatcher.java:84)
    at weblogic.wsee.ws.WsSkel.invoke(WsSkel.java:60)
    at weblogic.wsee.server.servlet.SoapProcessor.handlePost(SoapProcessor.java:66)
    at weblogic.wsee.server.servlet.SoapProcessor.process(SoapProcessor.java:44)
    at weblogic.wsee.server.servlet.BaseWSServlet$AuthorizedInvoke.run(BaseWSServlet.java:124)
    at weblogic.wsee.server.servlet.BaseWSServlet.service(BaseWSServlet.java:53)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:165)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3153)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1973)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1880)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1310)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
    ; nested exception is: java.lang.NullPointerException
    at weblogic.ejb.container.internal.EJBRuntimeUtils.throwEJBException(EJBRuntimeUtils.java:141)
    at weblogic.ejb.container.internal.BaseLocalObject.handleSystemException(BaseLocalObject.java:643)
    at weblogic.ejb.container.internal.BaseLocalObject.handleSystemException(BaseLocalObject.java:604)
    at weblogic.ejb.container.internal.BaseLocalObject.postInvoke1(BaseLocalObject.java:347)
    at weblogic.ejb.container.internal.BaseLocalObject.postInvokeTxRetry(BaseLocalObject.java:286)
    Truncated. see log file for complete stacktrace

    Jason Gilman wrote:
    We are using weblogic 9.1 CMP entity beans with BEA's XA oracle driver. We have a bean called User that has a many address beans. When calling the getAddresses method on a UserLocal a NullPointerException gets thrown if the stateless session bean method that is marked as @LocalMethod(transactionAttribute=Constants.TransactionAttribute.SUPPORTS). If we change it to REQUIRED the method returns addresses successfully. Does anyone have any ideas as to what could be causing this? Below is the stack trace
    My best guess is that an exception is occurring and when weblogic tries to handle the exception EJBRuntimeUtils.throwEJBException encounters the NullPointerException.
    Open an official support case. This has nothing to do with jdbc.
    Joe
    >
    >
    javax.ejb.EJBException: EJB Exception: : java.lang.NullPointerException
    at gov.nasa.echo.dataaccessobjects.user.echo_user_User_l47u68__WebLogic_CMP_RDBMS_addresses_Set.<init>(echo_user_User_l47u68__WebLogic_CMP_RDBMS_addresses_Set.java
    :93)
    at gov.nasa.echo.dataaccessobjects.user.echo_user_User_l47u68__WebLogic_CMP_RDBMS.getAddresses(echo_user_User_l47u68__WebLogic_CMP_RDBMS.java:1161)
    at gov.nasa.echo.dataaccessobjects.user.echo_user_User_l47u68_ELOImpl.getAddresses(echo_user_User_l47u68_ELOImpl.java:770)
    at gov.nasa.echo.subsystems.user.UserTypeMap.convertUser(UserTypeMap.java:66)
    at gov.nasa.echo.subsystems.user.UserSubsystem.getUserByUserId(UserSubsystem.java:321)
    at gov.nasa.echo.subsystems.user.UserSubsystem.getUsersByUserId(UserSubsystem.java:302)
    at gov.nasa.echo.services.authentication.AuthenticationServiceBean.login(AuthenticationServiceBean.java:442)
    at gov.nasa.echo.services.authentication.AuthenticationServiceBean_plcr77_ELOImpl.login(AuthenticationServiceBean_plcr77_ELOImpl.java:1001)
    at gov.nasa.echo.v8.AuthenticationServicePortImpl.login(AuthenticationServicePortImpl.java:105)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at weblogic.wsee.component.pojo.JavaClassComponent.invoke(JavaClassComponent.java:91)
    at weblogic.wsee.ws.dispatch.server.ComponentHandler.handleRequest(ComponentHandler.java:68)
    at weblogic.wsee.handler.HandlerIterator.handleRequest(HandlerIterator.java:127)
    at weblogic.wsee.ws.dispatch.server.ServerDispatcher.dispatch(ServerDispatcher.java:84)
    at weblogic.wsee.ws.WsSkel.invoke(WsSkel.java:60)
    at weblogic.wsee.server.servlet.SoapProcessor.handlePost(SoapProcessor.java:66)
    at weblogic.wsee.server.servlet.SoapProcessor.process(SoapProcessor.java:44)
    at weblogic.wsee.server.servlet.BaseWSServlet$AuthorizedInvoke.run(BaseWSServlet.java:124)
    at weblogic.wsee.server.servlet.BaseWSServlet.service(BaseWSServlet.java:53)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:165)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3153)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1973)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1880)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1310)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
    ; nested exception is: java.lang.NullPointerException
    at weblogic.ejb.container.internal.EJBRuntimeUtils.throwEJBException(EJBRuntimeUtils.java:141)
    at weblogic.ejb.container.internal.BaseLocalObject.handleSystemException(BaseLocalObject.java:643)
    at weblogic.ejb.container.internal.BaseLocalObject.handleSystemException(BaseLocalObject.java:604)
    at weblogic.ejb.container.internal.BaseLocalObject.postInvoke1(BaseLocalObject.java:347)
    at weblogic.ejb.container.internal.BaseLocalObject.postInvokeTxRetry(BaseLocalObject.java:286)
    Truncated. see log file for complete stacktrace

  • JDev 1013 BUG? EJB, CMR, DTO and session facade.

    I've created two CMP Entity EJB's, CourseEJB and PupilEJB, and defined a M:N relationship between them. A course has many pupils and vice versa. Each bean has only two attributes, id (Long, part of PK) and name (String) for simplicity.
    1. Generated DTO's for the two beans won't compile
    I get error on:
    public void addcourseEJBLocalDTO(courseEJBLocalDTO courseEJBLocalDTO)
    coursesDTO.add(courseEJBLocalDTO);
    courseEJBLocalDTO.setPupilsDTO(this);
    and:
    public void addPupilEJBLocalDTO(PupilEJBLocalDTO pupilEJBLocalDTO)
    pupilsDTO.add(pupilEJBLocalDTO);
    pupilEJBLocalDTO.setCoursesDTO(this);
    because JDev has created definitions of the setCoursesDTO function like this:
    public void setCoursesDTO(Collection<courseEJBLocalDTO> coursesDTO)
    this.coursesDTO = coursesDTO;
    and ditto for the setPupilsDTO method, taking a Collection as argument too.
    I can fix this code manually, but next step, generating a session Facade with added methods for handling the entity beans isn't exactly any better...
    One M:N relation is pretty basic, am I doing something wrong here?
    Message was edited by:
    jonmarti

    Forgot to add, running on 1013

  • How does Ejb maintain relationship

    How does EJB maintain a link between the EJBRemoteObject,EJBHome and
    the EJBClass
    and why does EJBClass implements SessionBean and the rest of the classes extend a paticular classes.
    What is their relation.

    EJBRemoteObject (or EJBObject) and EJBLoclaObject are interfaces that user can use to access an object. If you use remote object user can access the object remotely. Local object can be accessed remotely only via another session bean that locates in the JVM of local bean and implements remote interface.
    The EJBHome and EJBLocalHome are factories of objects. User uses them like:
    UserHome userHome = JNDI.getRootContext().getObject("EJB/UserBean").narrow(UserHome.class);
    User user = userHome.create("Andreas", "Papandreas");
    user.setRole("admin");
    // here UserHome is interface extending EJBHome
    // here User is interface extending EJBObject
    // User looks like EntityBeanEJBClass that implement SessionBean or EntityBean are abstract classes. They will be extended by application server. The application server creates stubs for client JVM as well. These subs marshall data to EJBClass on server. You may override some methods in EJBClass, for example initializing some fields on object creation. Setters and getters (required in entity beans) remain abstract in the EJBClass, they are left for application server implementation.
    I have all this info from good tutorial at IBM's site http://www-106.ibm.com/developerworks/views/java/tutorials.jsp. Tutorial is called "Introduction to container-managed persistence and relationships
    ", Parts 1-4.

  • One-to-one two sided relationship causing two outer joins.

    We have a fairly simple one-to-one relationship between two objects A and
    B. A maps to table A, B maps to table B. A holds a foreign key to B. Both
    classes hold a reference to each other.
    What we are trying to achieve is to load both A and B with a single
    intelligent SQL query. The only thing we can achieve is either two queries
    or one query with two outer joins.
    When both A and B have the other in the default fetch group and
    EagerFetchMode set to join, Kodo dispatches is something like this:
    SELECT whatever FROM A t0 LEFT OUTER JOIN B t1 ON t0.B_ID = t1.ID LEFT
    OUTER JOIN A t2 ON t1.ID = t2.B_ID
    The obvious problem with this is that is is going to be very innefficient.
    Isn't the second join needed?
    If the eager fetch mode is kept the same but A is removed from the default
    fetch group of B then we get two queries. The first one is a left outer
    join between A and B and loads all the columns from both A and B. (At this
    point in a debugger, A holds a reference to B, but B's reference to A is
    null). The second query fetchs all columns from B. But still the reference
    to A is null. It's only when we actually navigate to A from a B that the
    reference is populated. (Luckily no query is executed at this point).
    Is there anyway to achieve the loading of both objects with a single SQL
    query dispatched by Kodo?

    You should be able to get what you want by querying for the B instance with A in
    its default fetch group (but keeping B out of A's default fetch group). It
    shoudl result in one query with a single outer join, and no additional queries
    when you traverse the A.B relation.
    The reason for the two joins/queries in other scenarios is that Kodo treats each
    direction of the relation as a separate relation that has to be fetched on its
    own. The reason the above solution should work is that when the A record is
    read, the foreign key values for the B record are cached. When you traverse the
    A.B relation after both A and B are loaded, Kodo matches these cached foreign
    key values to the B instance in the PM cache and doesn't require a DB trip.

  • Defining a many-to-many relationship with CMP EJBs  : does it work for you

    Curious to know whether someone has been able to set up a many to many relationship between two entity beans.
    I have been struggling with this for days now and I can't get it to work.
    In my test project I have two entity beans, resp. Consultant and Solution.
    Consultant has a cmr field called 'solutions', which is a collection object from the opposite side (Solution).
    This is the source of the ejb-jar.xml file
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
         <description>EJB JAR description</description>
         <display-name>EJB JAR</display-name>
         <enterprise-beans>
              <session>
                   <ejb-name>ProfilerBean</ejb-name>
                   <home>com.atosorigin.tcc.testing.ejbses.profiling.ProfilerHome</home>
                   <remote>com.atosorigin.tcc.testing.ejbses.profiling.Profiler</remote>
                   <local-home>com.atosorigin.tcc.testing.ejbses.profiling.ProfilerLocalHome</local-home>
                   <local>com.atosorigin.tcc.testing.ejbses.profiling.ProfilerLocal</local>
                   <ejb-class>com.atosorigin.tcc.testing.ejbses.profiling.ProfilerBean</ejb-class>
                   <session-type>Stateless</session-type>
                   <transaction-type>Container</transaction-type>
                   <ejb-local-ref>
                        <ejb-ref-name>EJBTesting/Solution</ejb-ref-name>
                        <ejb-ref-type>Entity</ejb-ref-type>
                        <local-home>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionLocalHome</local-home>
                        <local>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionLocal</local>
                        <ejb-link>SolutionBean</ejb-link>
                   </ejb-local-ref>
                   <ejb-local-ref>
                        <ejb-ref-name>EJBTesting/Consultant</ejb-ref-name>
                        <ejb-ref-type>Entity</ejb-ref-type>
                        <local-home>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantLocalHome</local-home>
                        <local>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantLocal</local>
                        <ejb-link>ConsultantBean</ejb-link>
                   </ejb-local-ref>
              </session>
              <entity>
                   <ejb-name>ConsultantBean</ejb-name>
                   <home>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantHome</home>
                   <remote>com.atosorigin.tcc.testing.ejbcmp.profiling.Consultant</remote>
                   <local-home>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantLocalHome</local-home>
                   <local>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantLocal</local>
                   <ejb-class>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantBean</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>Consultant</abstract-schema-name>
                   <cmp-field>
                        <field-name>firstname</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>lastname</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>country</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>id</field-name>
                   </cmp-field>
                   <primkey-field>id</primkey-field>
                   <query>
                        <query-method>
                             <method-name>findBySolution</method-name>
                             <method-params>
                                  <method-param>java.lang.String</method-param>
                             </method-params>
                        </query-method>
                        <ejb-ql>SELECT Object(c) FROM Consultant AS c,
                        IN(c.solutions) s WHERE s.id = ?1 </ejb-ql>
                   </query>
              </entity>
              <entity>
                   <ejb-name>SolutionBean</ejb-name>
                   <home>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionHome</home>
                   <remote>com.atosorigin.tcc.testing.ejbcmp.profiling.Solution</remote>
                   <local-home>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionLocalHome</local-home>
                   <local>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionLocal</local>
                   <ejb-class>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionBean</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>Solution</abstract-schema-name>
                   <cmp-field>
                        <field-name>description</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>name</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>parent</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>id</field-name>
                   </cmp-field>
                   <primkey-field>id</primkey-field>
                   <query>
                        <query-method>
                             <method-name>findChildSolutions</method-name>
                             <method-params>
                                  <method-param>java.lang.String</method-param>
                             </method-params>
                        </query-method>
                        <ejb-ql>SELECT Object(s) FROM Solution AS s WHERE
                        s.parent = ?1</ejb-ql>
                   </query>
                   <query>
                        <query-method>
                             <method-name>findTopLevelSolutions</method-name>
                             <method-params/>
                        </query-method>
                        <ejb-ql>Select Object(s) FROM Solution AS s WHERE
                        (s.parent = &apos;none&apos;)</ejb-ql>
                   </query>
              </entity>
         </enterprise-beans>
         <relationships>
              <ejb-relation>
                   <description>A consultant may have one or more areas of expertise</description>
                   <ejb-relation-name>Consultant_Solutions</ejb-relation-name>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>com.atosorigin.tcc.testing.ejbcmp.profiling.ConsultantBean</ejb-relationship-role-name>
                        <multiplicity>Many</multiplicity>
                        <relationship-role-source>
                             <ejb-name>ConsultantBean</ejb-name>
                        </relationship-role-source>
                        <cmr-field>
                             <cmr-field-name>solutions</cmr-field-name>
                             <cmr-field-type>java.util.Collection</cmr-field-type>
                        </cmr-field>
                   </ejb-relationship-role>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>com.atosorigin.tcc.testing.ejbcmp.profiling.SolutionBean</ejb-relationship-role-name>
                        <multiplicity>Many</multiplicity>
                        <relationship-role-source>
                             <ejb-name>SolutionBean</ejb-name>
                        </relationship-role-source>
                   </ejb-relationship-role>
              </ejb-relation>
         </relationships>
         <assembly-descriptor>
              <container-transaction>
                   <description>container-transaction</description>
                   <method>
                        <ejb-name>SolutionBean</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <method>
                        <ejb-name>ProfilerBean</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <method>
                        <ejb-name>ConsultantBean</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <trans-attribute>Required</trans-attribute>
              </container-transaction>
         </assembly-descriptor>
    </ejb-jar>
    I created a stateless session bean as a business facade for the two entity beans. I then created a webservice to test the beans.
    What works :
    - create a consultant
    - get a consultant
    - create a solution
    - get a solution
    (basically everything that doesn't involve the relationship field.
    However, what doesn't work is the method call assignSolution:
    - assign solution : this is implemented as follows
    Business Method.
         public void assignSolution(String consultantID, String solutionID)
              throws ProfilingException {
              // TODO : Implement
              ConsultantLocal cons = null;
              SolutionLocal sol = null;
              try {
                   cons = consHome.findByPrimaryKey(consultantID);
                   sol = solHome.findByPrimaryKey(solutionID);
                   Collection solutions = cons.getSolutions();
                   solutions.add(sol);
                   //sol.getConsultants().add(cons);
              } catch (FinderException ex) {
                   ex.printStackTrace();
                   throw new ProfilingException("failed to retrieve data from DB", ex);
    As you can see I am trying to use the CM Relationship in this methhod. Adding the solution to a consultant should be as simple as adding a solution object to the collection retrieved with the getSolutions accessor. The Container is expected to persist the information in my MAXDB database.
    However this doesn't happen.
    The ORM details as defined in the persistent.xml follows :
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE persistent-ejb-map SYSTEM "persistent.dtd">
    <persistent-ejb-map>
         <locking
              type="Table"/>
         <db-properties>
              <data-source-name>TCC_PORTAL_PROFILER</data-source-name>
              <database-vendor
                   name="SAPDB"/>
         </db-properties>
         <entity-beans>
              <entity-bean>
                   <ejb-name>ConsultantBean</ejb-name>
                   <table-name>PFL_CONSULTANTS</table-name>
                   <field-map
                        key-type="NoKey">
                        <field-name>firstname</field-name>
                        <column>
                             <column-name>FIRSTNAME</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="NoKey">
                        <field-name>lastname</field-name>
                        <column>
                             <column-name>LASTNAME</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="NoKey">
                        <field-name>country</field-name>
                        <column>
                             <column-name>COUNTRY</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="PrimaryKey">
                        <field-name>id</field-name>
                        <column>
                             <column-name>ID</column-name>
                        </column>
                   </field-map>
                   <finder-descriptor>
                        <method-name>findBySolution</method-name>
                        <method-params>
                             <method-param>java.lang.String</method-param>
                        </method-params>
                        <load-selected-objects
                             lock="read"/>
                   </finder-descriptor>
              </entity-bean>
              <entity-bean>
                   <ejb-name>SolutionBean</ejb-name>
                   <table-name>PFL_SAPSOLUTIONS</table-name>
                   <field-map
                        key-type="NoKey">
                        <field-name>description</field-name>
                        <column>
                             <column-name>DESCRIPTION</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="NoKey">
                        <field-name>name</field-name>
                        <column>
                             <column-name>NAME</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="NoKey">
                        <field-name>parent</field-name>
                        <column>
                             <column-name>PARENTID</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="PrimaryKey">
                        <field-name>id</field-name>
                        <column>
                             <column-name>ID</column-name>
                        </column>
                   </field-map>
                   <finder-descriptor>
                        <method-name>findChildSolutions</method-name>
                        <method-params>
                             <method-param>java.lang.String</method-param>
                        </method-params>
                        <load-selected-objects
                             lock="read"/>
                   </finder-descriptor>
                   <finder-descriptor>
                        <method-name>findTopLevelSolutions</method-name>
                        <method-params/>
                        <load-selected-objects
                             lock="read"/>
                   </finder-descriptor>
              </entity-bean>
         </entity-beans>
         <relationships>
              <table-relation>
                   <help-table>PFL_CONS_SOL_MAP</help-table>
                   <table-relationship-role
                        key-type="PrimaryKey">
                        <ejb-name>ConsultantBean</ejb-name>
                        <cmr-field>solutions</cmr-field>
                        <fk-column>
                             <column-name>CONSULTANTID</column-name>
                             <pk-field-name>id</pk-field-name>
                        </fk-column>
                   </table-relationship-role>
                   <table-relationship-role
                        key-type="PrimaryKey">
                        <ejb-name>SolutionBean</ejb-name>
                        <fk-column>
                             <column-name>SOLUTIONID</column-name>
                             <pk-field-name>id</pk-field-name>
                        </fk-column>
                   </table-relationship-role>
              </table-relation>
         </relationships>
    </persistent-ejb-map>
    The error in the default trace file when calling the method states, there is an "inconsistency in the number of primary keys". Details follow.
    #1.5#000F1F188E5C004400000000000010480003E76C80EFD57A#1098880364327#com.sap.engine.services.ejb#com.atosorigin.tcc/EJBCMPProfilingTest#com.sap.engine.services.ejb#Guest#2####4d2b2370281411d9a40d000f1f188e5c#SAPEngine_Application_Thread[impl:3]_31##0#0#Error##Java###
    [EXCEPTION]
    #1#com.sap.engine.services.ejb.exceptions.BaseRemoteException: Exception in method assignSolution.
         at com.atosorigin.tcc.testing.ejbses.profiling.ProfilerObjectImpl0.assignSolution(ProfilerObjectImpl0.java:822)
         at com.atosorigin.tcc.testing.ejbses.profiling.Profiler_Stub.assignSolution(Profiler_Stub.java:533)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187)
         at $Proxy73.assignSolution(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sap.engine.services.webservices.runtime.EJBImplementationContainer.invokeMethod(EJBImplementationContainer.java:126)
         at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:146)
         at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:68)
         at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPost(ServletDispatcherImpl.java:92)
         at SoapServlet.doPost(SoapServlet.java:51)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:339)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:317)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:810)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:238)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
         at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
    Caused by: com.sap.engine.services.applocking.exception.SAPAppLockingIllegalArgumentException: Inconsistency in number of primary keys
         at com.sap.engine.services.applocking.TableLockingImpl.getArgument(TableLockingImpl.java:385)
         at com.sap.engine.services.applocking.TableLockingImpl.lock(TableLockingImpl.java:128)
         at com.sap.engine.services.applocking.TableLockingImpl.lock(TableLockingImpl.java:138)
         at com.sap.engine.services.ejb.entity.pm.lock.TableLockingSystem.write(TableLockingSystem.java:82)
         at com.sap.engine.services.ejb.entity.pm.PersistentM2M.create(PersistentM2M.java:172)
         at com.sap.engine.services.ejb.entity.pm.PersistentCacheM2M.add(PersistentCacheM2M.java:197)
         at com.sap.engine.services.ejb.entity.pm.multiple.CollectionM2M.add(CollectionM2M.java:57)
         at com.atosorigin.tcc.testing.ejbses.profiling.ProfilerBean.assignSolution(ProfilerBean.java:201)
         at com.atosorigin.tcc.testing.ejbses.profiling.ProfilerObjectImpl0.assignSolution(ProfilerObjectImpl0.java:771)
         ... 32 more
    I can't figure out what the problem is with the ORM mapping defined.
    On the database level I have three tables. Consultant maps to PFL_CONSULTANT, Solution to PFL_SAPSOLUTIONS. The third table PFL_CONS_SOL_MAP is the help table used for the relationship (having two fields, which are in fact foreign keys from the other two tables to express the assignment of solutions to consultants (where a consultant can have one or more solutions).
    ps. : I am running Netweaver Developer Workplace (Netweaver 2004, at stack level 5)
    Message was edited by: Theo Paesen

    Hm, after disabling 'automatic locking' it works.

  • Help: IllegalExpressionException vs. EJB 2.1 many-to-many relationship

    Using Oracle WebLogic 11g (10.3.4). The appc tool is generating a warning regarding an illegal EJB QL expression for a many-to-may relationship in an EJB 2 Bean.
    Details:
    * Entity Bean "MSProduktKonfiguration"
    * Entity Bean "MSAngebot"
    * n-m relationship betwenn these two Entites, from MSProduktKonfiguration to MSAngebot by cmr field angebotLocal, from MSAngebot to MSProduktKonfiguration by cmr field produktKonfigurationenLocal
    * Join table "MS_PRODUKT.ANGEBOT_POSITION"
    Warnings from appc:
    [java] Warning: [EJB:013094]The SELECT clause of this query contains an identifier 'bean.angebotLocal' that ends in a cmr-field. The EJB 2.1 specification section 11.2.7.1 requires that any related null objects belonging to the set corresponding to this cmr-field must be returned by this query however the database that will be used to execute this query does not sufficiently support SQL outer joins, therefore this query will not return any null objects that might otherwise be returned.
    [java] Warning: [EJB:013094]The SELECT clause of this query contains an identifier 'bean.produktKonfigurationenLocal' that ends in a cmr-field. The EJB 2.1 specification section 11.2.7.1 requires that any related null objects belonging to the set corresponding to this cmr-field must be returned by this query however the database that will be used to execute this query does not sufficiently support SQL outer joins, therefore this query will not return any null objects that might otherwise be returned.
    I have no clue what's going on there. Maybe someone can help me out.
    Snippet from the ejb-jar.xml Deployment Descriptor:
    <ejb-relation id="EJBRelation_9">
    <ejb-relation-name>Angebot-ProduktKonfiguration</ejb-relation-name>
    <ejb-relationship-role id="EJBRelationshipRole_17">
    <ejb-relationship-role-name>ProduktKonfigurationen-Have-Angebote</ejb-relationship-role-name>
    <multiplicity>Many</multiplicity>
    <relationship-role-source id="RoleSource_17">
    <ejb-name>MSProduktKonfiguration</ejb-name>
    </relationship-role-source>
    <cmr-field id="CMRField_9">
    <cmr-field-name>angebotLocal</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role id="EJBRelationshipRole_18">
    <ejb-relationship-role-name>Angebote-Have-ProduktKonfigurationen</ejb-relationship-role-name>
    <multiplicity>Many</multiplicity>
    <relationship-role-source id="RoleSource_18">
    <ejb-name>MSAngebot</ejb-name>
    </relationship-role-source>
    <cmr-field id="CMRField_10">
    <cmr-field-name>produktKonfigurationenLocal</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    Snippet from the weblogic-cmp-rdbms-jar.xml Deployment Descriptor:
    <weblogic-rdbms-relation>
    <relation-name>Angebot-ProduktKonfiguration</relation-name>
    <table-name>MS_PRODUKT.ANGEBOT_POSITION</table-name>
    <weblogic-relationship-role>
    <relationship-role-name>Angebote-Have-ProduktKonfigurationen</relationship-role-name>
    <relationship-role-map>
    <column-map>
    <foreign-key-column>angebot_id</foreign-key-column>
    <key-column>angebot_id</key-column>
    </column-map>
    </relationship-role-map>
    </weblogic-relationship-role>
    <weblogic-relationship-role>
    <relationship-role-name>ProduktKonfigurationen-Have-Angebote</relationship-role-name>
    <relationship-role-map>
    <column-map>
    <foreign-key-column>produkt_konfiguration_id</foreign-key-column>
    <key-column>produkt_konfiguration_id</key-column>
    </column-map>
    </relationship-role-map>
    </weblogic-relationship-role>
    </weblogic-rdbms-relation>

    Hi,
    There are many differences between EJB 1.1 and 2.0. Most of these are
    regarding CMP entity EJBs. I would say you should go with 2.0 if you have
    entity EJBs.
    Also EJB 2.0 has local interfaces and message-driven beans (JMS listeners).
    Emmanuel
    "Brian" <[email protected]> wrote in message
    news:3cf3b4eb$[email protected]..
    >
    Our standard development tool here is WebGain Visual Cafe 4.5.1. I am toldthat this
    tool does not support EJB 2.0. We are generating EJB's through the wizardbased interface
    of Visual Cafe.
    Is there a compelling reason to use EJB 2.0 instead of 1.1, even thoughthe tool
    doesn't support it? Is the time saved by automatic generation of EJB 1.1beans outweighed
    by improvements in EJB 2.0?
    Thanks for you help!

  • EJB representing optional relationship

    Hi,
    I was wondering how does EJB 2.0 deployment descriptor handles the 1 to 1/0 relationship between 2 entites. For example, 1 course can have 0 or 1 textbook. In this case, textbook is optional and might be represented as null in the database.
    The following represents 1-to-many relationship, how can I define 1-to-1/0 relationship? Please help. Thanks.
    <relationships>
       <ejb-relation>
          <ejb-relation-name>Textbook-Course</ejb-relation-name>
          <ejb-relationship-role>
             <ejb-relationship-role-name>Textbook-has-Course</ejb-relationship-role-name>
             <multiplicity>many</multiplicity>
             <relationship-role-source>
                <ejb-name>TextbookBean</ejb-name>
             </relationship-role-source>
             <cmr-field>
                <cmr-field-name>course</cmr-field-name>
             </cmr-field>
          </ejb-relationship-role>
          <ejb-relationship-role>
             <ejb-relationship-role-name>Course-has-Textbook</ejb-relationship-role-name>
             <multiplicity>one</multiplicity>
             <relationship-role-source>
                <ejb-name>CourseBean</ejb-name>
             </relationship-role-source>
             <cmr-field>
                <cmr-field-name>textbooks</cmr-field-name>
                <cmr-field-type>java.util.Collection</cmr-field-type>
             </cmr-field>
          </ejb-relationship-role>
       </ejb-relation>
    </relationships>

    hi,
    I think you can use 1-1 relation for your case. It will also take care of 1-0.
    You just need to update the Textbook-Course multiplicity tag.
    Set multiplicityto one
    If there is no textbook in a course the Collection will be empty. if you strictly want to model 1 -1/0 , then no need to using Collection in following tag. Just use the type of TextBookbean's remote interface.
    <cmr-field>
        <cmr-field-name>textbooks</cmr-field-name>           
        <cmr-field-type>java.util.Collection</cmr-field-type>        
    </cmr-field>I am using the same technique in our application . We take help of model 1-1 for 1-0 type of relation.
    regards,
    Amit

  • JDeveloper Unilateral relationship ejb-jar.xml verifying error

    I am huge difficulty with tables that have relationships mapping in one direction (unilateral).
    If I give you a really basic scenario of table Emp which has Employee information and a Dept_no foreign key. I also have a table Dept which has department info and includes it's primary key of Dept_no.
    When dragging and dropping tables from the Oracle Database onto the UML Diagram (OC4J container), the relationships automatically configure as bilateral. The ejb-jar.xml builds and the verifying Enterprise Beans verifies OK. If I select the relationship on the diagram and change it to be unilateral from Employee -> Department, it will still compile the EJB related source, but the ejb-jar.xml file will no longer verify the Enterprise Beans.
    Now there have been a million ways that I have tried to get this simple example to work.
    Here's my ejb-jar.xml and the orion-ejb-jar.xml:
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    <enterprise-beans>
    <entity>
    <description>Entity Bean ( CMP )</description>
    <display-name>Dept</display-name>
    <ejb-name>Dept</ejb-name>
    <local-home>nz.co.fal.DeptLocalHome</local-home>
    <local>nz.co.fal.DeptLocal</local>
    <ejb-class>nz.co.fal.impl.DeptBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.Long</prim-key-class>
    <reentrant>False</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>Dept</abstract-schema-name>
    <cmp-field>
    <field-name>deptno</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>dname</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>loc</field-name>
    </cmp-field>
    <primkey-field>deptno</primkey-field>
    </entity>
    <entity>
    <description>Entity Bean ( CMP )</description>
    <display-name>Emp</display-name>
    <ejb-name>Emp</ejb-name>
    <local-home>nz.co.fal.EmpLocalHome</local-home>
    <local>nz.co.fal.EmpLocal</local>
    <ejb-class>nz.co.fal.impl.EmpBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.Long</prim-key-class>
    <reentrant>False</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>Emp</abstract-schema-name>
    <cmp-field>
    <field-name>empno</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>ename</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>job</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>mgr</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>hiredate</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>sal</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>comm</field-name>
    </cmp-field>
    <primkey-field>empno</primkey-field>
    </entity>
    </enterprise-beans>
    <relationships>
    <ejb-relation>
    <ejb-relation-name>Emp - Dept</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>Dept may have one Emp</ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>Dept</ejb-name>
    </relationship-role-source>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>Emp may have one Dept</ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>Emp</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>dept_deptno</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    </relationships>
    </ejb-jar>
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE orion-ejb-jar PUBLIC "-//Evermind//DTD Enterprise JavaBeans 1.1 runtime//EN" "http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd">
    <orion-ejb-jar>
    <enterprise-beans>
    <entity-deployment name="Dept" data-source="jdbc/Connection1DS" table="DEPT">
    <primkey-mapping>
    <cmp-field-mapping name="deptno" persistence-name="DEPTNO" persistence-type="NUMBER(2)"/>
    </primkey-mapping>
    <cmp-field-mapping name="deptno" persistence-name="DEPTNO" persistence-type="NUMBER(2)"/>
    <cmp-field-mapping name="dname" persistence-name="DNAME" persistence-type="VARCHAR2(14)"/>
    <cmp-field-mapping name="loc" persistence-name="LOC" persistence-type="VARCHAR2(13)"/>
    </entity-deployment>
    <entity-deployment name="Emp" data-source="jdbc/Connection1DS" table="EMP">
    <primkey-mapping>
    <cmp-field-mapping name="empno" persistence-name="EMPNO" persistence-type="NUMBER(4)"/>
    </primkey-mapping>
    <cmp-field-mapping name="empno" persistence-name="EMPNO" persistence-type="NUMBER(4)"/>
    <cmp-field-mapping name="ename" persistence-name="ENAME" persistence-type="VARCHAR2(10)"/>
    <cmp-field-mapping name="job" persistence-name="JOB" persistence-type="VARCHAR2(9)"/>
    <cmp-field-mapping name="mgr" persistence-name="MGR" persistence-type="NUMBER(4)"/>
    <cmp-field-mapping name="hiredate" persistence-name="HIREDATE" persistence-type="DATE"/>
    <cmp-field-mapping name="sal" persistence-name="SAL" persistence-type="NUMBER(7,2)"/>
    <cmp-field-mapping name="comm" persistence-name="COMM" persistence-type="NUMBER(7,2)"/>
    <cmp-field-mapping name="dept_deptno">
    <entity-ref home="Dept">
    <cmp-field-mapping persistence-name="DEPTNO" persistence-type="NUMBER(2)"/>
    </entity-ref>
    </cmp-field-mapping>
    </entity-deployment>
    </enterprise-beans>
    <assembly-descriptor>
    <default-method-access>
    <security-role-mapping impliesAll="true" name="<default-ejb-caller-role>"/>
    </default-method-access>
    </assembly-descriptor>
    </orion-ejb-jar>
    DeptBean.java (Department ejb Bean class)
    package nz.co.fal.impl;
    import javax.ejb.EntityBean;
    import javax.ejb.EntityContext;
    import java.util.Collection;
    import nz.co.fal.EmpLocal;
    public abstract class DeptBean implements EntityBean {
    private EntityContext context;
    public Long ejbCreate() {
    return null;
    public void ejbPostCreate() {
    public Long ejbCreate(Long deptno) {
    setDeptno(deptno);
    return deptno;
    public void ejbPostCreate(Long deptno) {
    public void ejbActivate() {
    public void ejbLoad() {
    public void ejbPassivate() {
    public void ejbRemove() {
    public void ejbStore() {
    public void setEntityContext(EntityContext ctx) {
    this.context = ctx;
    public void unsetEntityContext() {
    this.context = null;
    public abstract Long getDeptno();
    public abstract void setDeptno(Long newDeptno);
    public abstract String getDname();
    public abstract void setDname(String newDname);
    public abstract String getLoc();
    public abstract void setLoc(String newLoc);
    DeptLocal.java
    package nz.co.fal;
    import javax.ejb.EJBLocalObject;
    import java.util.Collection;
    public interface DeptLocal extends EJBLocalObject {
    Long getDeptno();
    void setDeptno(Long newDeptno);
    String getDname();
    void setDname(String newDname);
    String getLoc();
    void setLoc(String newLoc);
    DeptLocalHome.java
    package nz.co.fal;
    import javax.ejb.EJBLocalHome;
    import javax.ejb.CreateException;
    import javax.ejb.FinderException;
    import java.util.Collection;
    public interface DeptLocalHome extends EJBLocalHome {
    DeptLocal create() throws CreateException;
    DeptLocal findByPrimaryKey(Long primaryKey) throws FinderException;
    Collection findAll() throws FinderException;
    DeptLocal create(Long deptno) throws CreateException;
    EmpBean.java (ejb Bean class for Emp)
    public abstract class EmpBean implements EntityBean {
    private EntityContext context;
    public Long ejbCreate() {
    return null;
    public void ejbPostCreate() {
    public Long ejbCreate(Long empno) {
    setEmpno(empno);
    return empno;
    public void ejbPostCreate(Long empno) {
    public void ejbActivate() {
    public void ejbLoad() {
    public void ejbPassivate() {
    public void ejbRemove() {
    public void ejbStore() {
    public void setEntityContext(EntityContext ctx) {
    this.context = ctx;
    public void unsetEntityContext() {
    this.context = null;
    public abstract Long getEmpno();
    public abstract void setEmpno(Long newEmpno);
    public abstract String getEname();
    public abstract void setEname(String newEname);
    public abstract String getJob();
    public abstract void setJob(String newJob);
    public abstract Long getMgr();
    public abstract void setMgr(Long newMgr);
    public abstract Timestamp getHiredate();
    public abstract void setHiredate(Timestamp newHiredate);
    public abstract Long getSal();
    public abstract void setSal(Long newSal);
    public abstract Long getComm();
    public abstract void setComm(Long newComm);
    public abstract DeptLocal getDept_deptno();
    public abstract void setDept_deptno(DeptLocal newDept_deptno);
    EmpLocal.java (ejb local interface for Emp)
    package nz.co.fal;
    import javax.ejb.EJBLocalObject;
    import java.sql.Timestamp;
    public interface EmpLocal extends EJBLocalObject {
    Long getEmpno();
    void setEmpno(Long newEmpno);
    String getEname();
    void setEname(String newEname);
    String getJob();
    void setJob(String newJob);
    Long getMgr();
    void setMgr(Long newMgr);
    Timestamp getHiredate();
    void setHiredate(Timestamp newHiredate);
    Long getSal();
    void setSal(Long newSal);
    Long getComm();
    void setComm(Long newComm);
    DeptLocal getDept_deptno();
    void setDept_deptno(DeptLocal newDept_deptno);
    EmpLocalHome.java (ejb local home for Emp)
    package nz.co.fal;
    import javax.ejb.EJBLocalHome;
    import javax.ejb.CreateException;
    import javax.ejb.FinderException;
    import java.util.Collection;
    public interface EmpLocalHome extends EJBLocalHome {
    EmpLocal create() throws CreateException;
    EmpLocal findByPrimaryKey(Long primaryKey) throws FinderException;
    Collection findAll() throws FinderException;
    EmpLocal create(Long empno) throws CreateException;
    that's probably all the relevant information.
    As I said if I can't map relationships unilaterally from Oracle tables, then that is a huge issue for our project.
    Any Help, would be fantastic - THANKYOU.
    Geoff

    Geoff,
    please repost your question in the JDeveloper forum
    JDeveloper and ADF
    the JDeveloper product management team monitors their forum and you will receive a faster response.
    thanks - OTN

  • Recursive relationship in CMR

    Hi,
    how can I declare a recursive CMR for a Parent-Chrildren relation.
    Here's my actual DD
    <ejb-relation>
    <ejb-relation-name>Person-Child</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>ParentOfChilds</ejb-relationship-role-name>
    <multiplicity>Many</multiplicity>
    <relationship-role-source>
    <ejb-name>PersonEJB</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>children</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>ChildrenHasParen</ejb-relationship-role-name>
    <multiplicity>Many</multiplicity>
    <relationship-role-source>
    <ejb-name>PersonEJB</ejb-name>
    </relationship-role-source>
    </ejb-relationship-role>
    </ejb-relation>
    The relationship is displayed correctly in deploytool. I tried with 1-N and
    M-N relation.
    But during deployment it only creates one table 'PersonEJBTable' and one
    table
    'PersonEJB_children_PersonEJB_Table'. The first one is correct is gets
    filled
    when I create Person entities. But the second table only has one column
    '_PersonEJB_name'
    and this one is not filled when I create a relationship like this
    InitialContext initial = new InitialContext();
    PersonLocalHome plh =
    (PersonLocalHome)initial.lookup("java:comp/env/ejb/local/Person");
    PersonLocal pl = plh.create(name);
    this.getChildren().add(pl);
    Can anyone tell me what I am doing wrong here?
    TIA
    Frank

    I just saw that there's an SQLExcpetion: EOF encountered when I assign a child to a person. I found out that the STORE statement was not generated by deploytool.
    And the table for the relationship also seems to be wrong as one column is not sufficient to save the realtionship.
    Any suggestions?
    TIA
    Frank

  • Need JSP with CMR EJB  Help

    hi
    regarding my question
    i am not clear how to use two bean one has foreign key and another has primary key in the client side
    for that i make two beans and make cmr relationship between them fine
    but when i call another bean in the client side i have to use findByPrimaryKey method to map the beans
    fine
    Cnmas cnn = cnhome.findByPrimaryKey(dpwb_no);
    now my problem is i have multiple records corresponding to the dpwb_no which is my primary key
    so for that should i use the iterator method
    and if i will not use then i am using local as well as remote home interfaces so in that case my code will be:-
    in the local interface:-
    public DodAuthorisationLocal findByPrimaryKey(String authorisationNo) throws FinderException;
    in the remote interface:-
    public DodAuthorisation findByPrimaryKey(String authorisationNo) throws RemoteException, FinderException;
    now my problem is that client will interact with local interface and we are makeing remote's home interface.
    because i have to use that values in the create method as parameter
    the create method has local interface's value as parameter and we are calling remote interface so tell me how to solve it
    CnmasHome cnhome = (CnmasHome)PortableRemoteObject.narrow(ctx.lookup("Cnmas"), CnmasHome.class);
    Cnmas cnn = cnhome.findByPrimaryKey(dpwb_no);
    in this code we use the remote interface
    this is my create method which i try to call
    public DodAuthorisation create(CnmasLocal cnn ) with more parameter
    so how to interact the local interface in the create method with the remotehome refrence with the findByPrimaryKey method.
    Now i think u can able to understand my problem
    thanks alot

    Hi Veronika,
    The <jsp:usebean> is used for only javabeans not EJB (Enterprise javabean). You said that you have deployed SpellCheck.jar to the JRun server. So that must be an EJB. Where are you accessing this EJB from in your JSP? ARe you doing it inside the projsp.SpellCheck javabean? If yes, can you post some code from the javabean.
    Cheers
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <jsp:useBean id="help" scope="request" class="projsp.SpellCheck"/>
    <jsp:setProperty name="help" property="*"/>
    <html>
    <head>
    <title>Untitled</title>
    </head>
    <body>
    You Entered the input,
    <b>
    <%= request.getParameter("word") %>
    </b>
    <br>
    The processed output is:<br>
    <%= integer.parseInt(request.getparameter("mode"))==1 ?help.reverse():""+help.check() %>
    </body>
    </html>

Maybe you are looking for

  • How do I get Apple to replace my phone while still under warranty?

    The sleep/wake button on my Iphone 3G has dropped significantly lower from its original position, so much so that it is hard to push to wake the screen. I've had this issue with the original phone and once before with the 3G and an exchange to get a

  • Goods Issue to Customer not done

    Dear All, We have customize service module. We can select Return, Goods Issue to Customer, Inventory Transfer activity from activity tab on Service call itself. Problem is..first i have return material from Customer , then i have transfer inventory f

  • TextEdit: set maximum length

    Hi, Is there a way of setting the maximum number of characters that may be entered in a text edit field. Many Thanks, Paul

  • Hate working with code? Zeldman says authoring good HTML and CSS is an art

    Visual designers often complain about the need to get their hands dirty with HTML and CSS, and long for a program that will do it all for them. According to web standards guru, Jeffrey Zeldman, they'll have a very long wait: http://www.zeldman.com/20

  • J2EE confusion in EJB Docu example!

    I installed the j2ee beta and following the track in the documentation to learn EJB. the sample works fine. But after observing the interfaces and EJB class, I got confused by the following facts: 1. the EJB class ConverterEJB does not 'implements' t