Plea for example - Many-to-Many CMP EJB

I am attempting to create an EJB that uses Container Managed Persistence,
but my situation seems to be an odd one. The EJB needs to have a
Many-to-Many relationship to itself, because the object is Hierarchical.
Because this is my first EJB I am having a hard time with all of the
deployment descriptors.
I am asking for an example of any Many-to-Many EJB relationship that uses
Weblogic's built-in link table creation to make the relationship (that
works). I realize that there are confidentiality issues with many people
releasing code. I will make any promise (short of selling my soul) that the
code will be safe and promply destroyed immediately after inspection.
Thanks for any help,
Tom
[email protected]

The following describes how to establish a self many-to-many relationship with regards to Product having many parent products and many children products. I have attached the example files as well. Most of these files were generated using EJBGen. I would highly recommend it...
EJB
v Navigating from a Product to its parent Products results in getParents() method in Product
§ Since a Product can have many parents the return type of getParents() method is
java.util.Collection
§ Calling setParents() method results in establishing the new links between this Parent and
parent Products
§ Adding a Product as Parent to the Product results in establishing a new link between this
Product and other Product as parent
· This product is made available in the collection of children in the other Product
§ Removing a Product as Parent to the Product results in breaking a link between this
Product and the other Product as parent
· This product is also removed from the collection of children in the other Product
v Navigating from a Product to its children Products results in getChildren() method in Product
§ Since a Product can have many children the return type of getChildren() method is
java.util.Collection
§ Calling setChildren() method results in breaking the old links between this Product and
children Products
§ Adding a Product as child to the Product results in establishing a new link between this
Product and other Product as child
· This product is made available in the collection of parents in the other Product
§ Removing a Product as child from the Product results in breaking a link between this
Product and the other Product as child
· This Product is also removed from the collection of parents in the other Product.
v Example: ProductBean
Ø DataBase
v For a many-to-many relationship define a new associative (join) table
v Define a new Parent_Child_Product associative table
v The Parent_Child_Product has compound primary keys: Parent_Product_ID and
Child_Product_ID
v Parent_Product_ID and Child_Product_ID are foreign keys to Product table
v Example: Product, Parent_Child_Product
Ø Deployment Descriptors
v ejb-jar.xml
§ Within <ejb-jar>.<relationships>.<ejb-relation> define the following:
· Name of the relationship
o Example: <ejb-relation-name>Parent-Product-Children</ejb-relation-name>
· Role from the parent Product side
o Source
§ Example:
<relationship-role-source>
<ejb-name>Product</ejb-name>
</relationship-role-source>
o Role name
§ Example: <ejb-relationship-role-name>many-Product@children-Have-Product</
ejb-relationship-role-name>
o Multiplicity
§ Example: <multiplicity>many</multiplicity>
o CMR field
§ Example:
<cmr-field>
<cmr-field-name>children</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
· Role from the child Product side
o Source
§ Example:
<relationship-role-source>
<ejb-name>Product</ejb-name>
</relationship-role-source>
o Role name
§ Example: <ejb-relationship-role-name>many-Product@parents-Have-Product</
ejb-relationship-role-name>
o Multiplicity
§ Example: <multiplicity>many</multiplicity>
o CMR field
§ Example:
<cmr-field>
<cmr-field-name>parents</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
v weblogic-ejb-jar.xml
v weblogic-cmp-rdbms-jar.xml
§ Within <weblogic-rdbms-jar>.<weblogic-rdbms-relation> specify the following:.23
· Name of the relationship matching the name in ejb-jar
o Example: <ejb-relation-name> Parent-Product-Children</ejb-relation-name>
· Specify the name of the joint table
o Example: <table-name> Parent_Child_Product</table-name>
· Specify the mapping using <weblogic-relationship-role>
o Specify the role name matching the name in the ejb-jar
§ Example: <relationship-role-name>many-Product@children-Have-Product</
relationship-role-name>
o Define <relationship-role-map> that defines the mapping of the foreign key to
the primary key mapping
§ Example:
<relationship-role-map>
<column-map>
<foreign-key-column>Parent_Product_ID</foreign-key-column>
<key-column>Product_ID</key-column>
</column-map>
</relationship-role-map>
· Specify the mapping using <weblogic-relationship-role>
o Specify the role name matching the name in the ejb-jar
§ Example: <relationship-role-name> many-Product@parents-Have-Product</
relationship-role-name>
o Define <relationship-role-map> that defines the mapping of the foreign key to
the primary key mapping
§ Example:
<relationship-role-map>
<column-map>
<foreign-key-column>Child_Product_ID</foreign-key-column>
<key-column>Product_ID</key-column>
</column-map>
</relationship-role-map>
"Thomas A. Valletta" <[email protected]> wrote in message news:[email protected]...
I am attempting to create an EJB that uses Container Managed Persistence,
but my situation seems to be an odd one. The EJB needs to have a
Many-to-Many relationship to itself, because the object is Hierarchical.
Because this is my first EJB I am having a hard time with all of the
deployment descriptors.
I am asking for an example of any Many-to-Many EJB relationship that uses
Weblogic's built-in link table creation to make the relationship (that
works). I realize that there are confidentiality issues with many people
releasing code. I will make any promise (short of selling my soul) that the
code will be safe and promply destroyed immediately after inspection.
Thanks for any help,
Tom
[email protected]
[att1.html]
[ejb-jar.xml]
[weblogic-cmp-rdbms-jar.xml]
[weblogic-ejb-jar.xml]
[ProductBean.java]
[ProductLocal.java]
[ProductLocalHome.java]

Similar Messages

  • 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.

  • Question abou CMP EJB

    those days i read the book 'enterprise java bean'
    i got some question while reading.
    1. in CMP EJB the container will take care the connect to the database and while deployment the ejb it will create the finder methods ( and other SQL statements ) right ?
    2. in CMP EJB, where is the database? i look some deployment file, can not find any thing about database.so where is it? and how container connect the database, it use jdbc as well ?
    3. When using EJB, the client part will run ejb sever as well? i think the ejb sever part will run the sever, the client will not, right?
    thanks for answer those questions. your help will be very appreciated.
    thanks

    those days i read the book 'enterprise java bean'
    i got some question while reading.
    1. in CMP EJB the container will take care the connect
    to the database and while deployment the ejb it will
    create the finder methods ( and other SQL statements )
    right ?
    If is is BMP (Bean Managed Persistence) then you have to do it, if it has CMP (Container Managed Persistence) then the container will do it for you.
    2. in CMP EJB, where is the database? i look some
    deployment file, can not find any thing about
    database.so where is it? and how container connect the
    database, it use jdbc as well ?
    The mapping between the EJB and the database is done in a vendor specific xml file, where you map the columns of the table(s) in the database to the fields in your EJB. In that XML file you will reference the database that you will use by referencing a connection pool or datasource.
    3. When using EJB, the client part will run ejb sever
    as well? i think the ejb sever part will run the
    sever, the client will not, right?The Client part doesn't run any container. You have to create a context to the Container running the EJB and then find it and use it.
    MSB

  • When previewing images by clicking on the thumbnail in an Event for example, I've been finding that many images preview in a 'zoomed in' way so only a small part of the photos is previewed in a highly magnified view.

    When previewing images by clicking on the thumbnail in an Event for example, I've been finding that many images preview in a 'zoomed in' way so only a small part of the photos is previewed in a highly magnified view.
    Initially I could find no cause. Then I tried right click - Edit and on the affected images, always get this warning:
    "Image Cannot Be Edited - This photo was previously edited with another application or with an early version of Iphoto. Duplicate this photo to edit it." and a "Duplicate To Edit" Button is displayed. 
    The external Editor defined for iPhoto is Adobe Photoshop Elements.
    Now, I reckon the MUST be others out there affected by this same apparent Preview bug, yet my searches have not revealed any answers.  Also seems impossible to find a contact number for adobe???
    Thanks

    Start '''[https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode Firefox in Safe Mode]''' {web Link} by holding down the '''<Shift ''(Mac Options)'' >''' key, and then starting Firefox. Is the problem still there?

  • HT1459 I have burned numerous cd's onto my old computer.  Many of these songs cannot be purchased on Itunes (Garth Brooks for example).  My old computer died and now I can't transfer these songs from my ipod onto my new computer.  How can I retreive my da

    I have burned numerous cd's onto my old computer.  Many of these songs cannot be purchased on Itunes (Garth Brooks for example).  My old computer died and now I can't transfer these songs from my ipod onto my new computer.  How can I retreive my data?

    What options do you have enabled from under your iPod's Summary and Music tabs for syncing preferences?
    B-rock

  • So I am trying to copy my hard drive "Macintosh HD" to an external hard drive, i want to use Terminal and have tried many ways. For example cp -r /Volumes/"Macintosh HD" /Volumes/"NO NAME". When i do it says No such file or directory. Ideas?

    So I am trying to copy my hard drive "Macintosh HD" to an external hard drive, i want to use Terminal and have tried many ways. For example cp -r /Volumes/"Macintosh HD" /Volumes/"NO NAME". When i do it says No such file or directory. Ideas?

    The reason that threadjacking is frowned on (as mentioned in the terms use which you can read by clicking the link to the right on this page) is for the most part a practical one:
    By starting your own thread your problem can get individual attention, focussed on your particular set of circumstances.
    By joining somebody else's thread it becomes tricky to answer more than one question at the same time, and can lead to confusion for both parties.
    So if you don't mind the minor inconvenience, please start your own thread (in the correct forum) so we can get to grips with your particular problem!

  • Sorry I'm new to Final Cut Express. How do you make an image (jpeg file for example) move across the screen slowly as I've seen in many films.

    Sorry I'm new to Final Cut Express. How do you make an image (jpeg file for example) move across the screen slowly as I've seen in many films.

    Neil from bristol wrote:
    … How do you make an image … move across the screen …
    by setting KEYFRAMES
    (read, what FC/e's built-in Help-feature tells about it)
    resize and set pic to start position
    set keyframe
    move playhead in timeline to desired length
    set pic to end position
    set keyframe …

  • Need example of adding attributes for many-to-many relationship

    Hi,
    Looking for examples of mappings and update code for many-to-many relationships with attributes.
    There is a doc in Metalink:206971.1 that says that it can be done but no examples are shown.
    Would realllly appreciate any help you can provide.
    Cheers,
    Nim

    Extended Many to Many Question
    Really there isn't any code to show. The recommendation is to create a class to represent the relationship. See link above for more details on the issue.
    - Don

  • Yosemite mail v8.0 not showing how many messages are in a mailbox. For example inbox. Before upgrading it used to show how many messages you had in your inbox. anyone know how to switch "on" the number of messages?

    Yosemite mail v8.0 not showing how many messages are in a mailbox. For example inbox. Before upgrading it used to show how many messages you had in your inbox. anyone know how to switch "on" the number of messages? Or has this feature been removed?

    Agreed! This feature was very useful. If you find out how to turn it on, please let me know.
    Apple, there is plenty of room in the window header all the way across on both sides of the word "Inbox". It's important to know many messages are in the Inbox. It provides a progress meter when you're cleaning out mail and striving for inbox zero.

  • Having recently updated Firefox, there now seems to be a long delay before many webpages load. Is there any way to easily revert to the previous arrangement, for example by removing new features that came with the upgrade that I probably don't use?

    Having recently updated Firefox, there now seems to be a long delay before many webpages load. Is there any way to easily revert to the previous arrangement, for example by removing new features that came with the upgrade that I probably don't use?

    Having recently updated Firefox, there now seems to be a long delay before many webpages load. Is there any way to easily revert to the previous arrangement, for example by removing new features that came with the upgrade that I probably don't use?

  • Many-To-Many CMP 2.0

    Hi,
    1)With a classic java object model, if we have a M:M relationship, we have to procedd this way Re: Many-to-many mapping question
    but with EJB, I cannot do that without getting a classCastException ; it seems that the example ejb cmp 2.0 relationships given with the toplink installation, we do not need to set the back reference. Then how is this working (Is this because of the bidirectionnal settings, but I thought, --Donald Smith sayed it is not good practise)?
    2)I have build a small example with customer and car ejb cmp 2.0. I add a car to a customer, it works without setting the back reference and without bidirectionnal relationship. But when I call again the instance of this customer after having deleted manually the car added of the relation table, the car does appears on the list of car for this customer which is not normal.
    I need to restart the server to get the normal behavior. Something else, if I add again the car to the csutomer, it adds several additionnal car, not in the database (probably because of the unique constraint) but in the collection of car of the client ejb instance and it does not throws any exception.
    I need some help for this issue.
    Vlad

    Here is the server output for the first add :
    [TopLink]: ServerSession(529044)--Connection(3011271)--SELECT NOM, IDCLIENT FROM CLIENT WHERE (IDCLI
    ENT = 33)
    [TopLink]: ServerSession(529044)--Connection(2942627)--SELECT NOM, IDVOITURE FROM VOITURE WHERE (IDV
    OITURE = 1904952)
    [TopLink]: ServerSession(529044)--Connection(0)--client acquired
    [TopLink]: ClientSession(7479016)--Connection(0)--acquire unit of work:5497685
    [TopLink]: UnitOfWork(5497685)--Connection(0)--JTS#register()
    [TopLink]: ServerSession(529044)--Connection(2446763)--SELECT t1.NOM, t1.IDVOITURE FROM CLIENT_VOITU
    RE t0, VOITURE t1 WHERE ((t0.IDCLIENT = 33) AND (t1.IDVOITURE = t0.IDVOITURE))
    [TopLink]: UnitOfWork(5497685)--Connection(0)--JTS#beforeCompletion()
    [TopLink]: UnitOfWork(5497685)--Connection(0)--JTS#afterCompletion()
    [TopLink]: UnitOfWork(5497685)--Connection(0)--release unit of work
    [TopLink]: ClientSession(7479016)--Connection(0)--client released
    Avant ajout : Voitures du client :
    ***cmp test client 11/07***
    Fin des voitures du client ***cmp test client 11/07***
    [TopLink]: ServerSession(529044)--Connection(0)--client acquired
    [TopLink]: ClientSession(93817)--Connection(0)--acquire unit of work:5617033
    [TopLink]: UnitOfWork(5617033)--Connection(0)--JTS#register()
    [TopLink]: UnitOfWork(5617033)--Connection(0)--JTS#beforeCompletion()
    [TopLink]: UnitOfWork(5617033)--Connection(2306830)--INSERT INTO CLIENT_VOITURE (IDVOITURE, IDCLIENT
    ) VALUES (1904952, 33)
    [TopLink]: UnitOfWork(5617033)--Connection(0)--JTS#afterCompletion()
    [TopLink]: UnitOfWork(5617033)--Connection(0)--release unit of work
    [TopLink]: ClientSession(93817)--Connection(0)--client released
    [TopLink]: ServerSession(529044)--Connection(0)--client acquired
    [TopLink]: ClientSession(1283170)--Connection(0)--acquire unit of work:7803223
    [TopLink]: UnitOfWork(7803223)--Connection(0)--JTS#register()
    [TopLink]: ServerSession(529044)--Connection(0)--client acquired
    [TopLink]: ClientSession(5140839)--Connection(0)--acquire unit of work:6868612
    [TopLink]: UnitOfWork(6868612)--Connection(0)--JTS#register()
    [TopLink]: UnitOfWork(6868612)--Connection(0)--JTS#beforeCompletion()
    [TopLink]: UnitOfWork(6868612)--Connection(0)--JTS#afterCompletion()
    [TopLink]: UnitOfWork(6868612)--Connection(0)--release unit of work
    [TopLink]: ClientSession(5140839)--Connection(0)--client released
    [TopLink]: UnitOfWork(7803223)--Connection(0)--JTS#beforeCompletion()
    [TopLink]: UnitOfWork(7803223)--Connection(0)--JTS#afterCompletion()
    [TopLink]: UnitOfWork(7803223)--Connection(0)--release unit of work
    [TopLink]: ClientSession(1283170)--Connection(0)--client released
    AprÞs ajout : Voitures du client :
    ***cmp test client 11/07***cmp test voiture 11/07
    Fin des voitures du client ***cmp test client 11/07***
    Here is the one for the second without having deleted the line in the relation table :
    [TopLink]: ServerSession(529044)--Connection(7555457)--SELECT NOM, IDCLIENT FROM CLIENT WHERE (IDCLI
    ENT = 33)
    [TopLink]: ServerSession(529044)--Connection(1739386)--SELECT NOM, IDVOITURE FROM VOITURE WHERE (IDV
    OITURE = 1904952)
    [TopLink]: ServerSession(529044)--Connection(0)--client acquired
    [TopLink]: ClientSession(5299092)--Connection(0)--acquire unit of work:7278394
    [TopLink]: UnitOfWork(7278394)--Connection(0)--JTS#register()
    [TopLink]: ServerSession(529044)--Connection(5339613)--SELECT t1.NOM, t1.IDVOITURE FROM CLIENT_VOITU
    RE t0, VOITURE t1 WHERE ((t0.IDCLIENT = 33) AND (t1.IDVOITURE = t0.IDVOITURE))
    [TopLink]: ServerSession(529044)--Connection(0)--client acquired
    [TopLink]: ClientSession(7106214)--Connection(0)--acquire unit of work:4437046
    [TopLink]: UnitOfWork(4437046)--Connection(0)--JTS#register()
    [TopLink]: UnitOfWork(4437046)--Connection(0)--JTS#beforeCompletion()
    [TopLink]: UnitOfWork(4437046)--Connection(0)--JTS#afterCompletion()
    [TopLink]: UnitOfWork(4437046)--Connection(0)--release unit of work
    [TopLink]: ClientSession(7106214)--Connection(0)--client released
    [TopLink]: UnitOfWork(7278394)--Connection(0)--JTS#beforeCompletion()
    [TopLink]: UnitOfWork(7278394)--Connection(0)--JTS#afterCompletion()
    [TopLink]: UnitOfWork(7278394)--Connection(0)--release unit of work
    [TopLink]: ClientSession(5299092)--Connection(0)--client released
    Avant ajout : Voitures du client :
    ***cmp test client 11/07***cmp test voiture 11/07
    Fin des voitures du client ***cmp test client 11/07***
    [TopLink]: ServerSession(529044)--Connection(0)--client acquired
    [TopLink]: ClientSession(7385032)--Connection(0)--acquire unit of work:5105875
    [TopLink]: UnitOfWork(5105875)--Connection(0)--JTS#register()
    [TopLink]: UnitOfWork(5105875)--Connection(0)--JTS#beforeCompletion()
    [TopLink]: UnitOfWork(5105875)--Connection(0)--JTS#afterCompletion()
    [TopLink]: UnitOfWork(5105875)--Connection(0)--release unit of work
    [TopLink]: ClientSession(7385032)--Connection(0)--client released
    [TopLink]: ServerSession(529044)--Connection(0)--client acquired
    [TopLink]: ClientSession(4134178)--Connection(0)--acquire unit of work:137003
    [TopLink]: UnitOfWork(137003)--Connection(0)--JTS#register()
    [TopLink]: ServerSession(529044)--Connection(0)--client acquired
    [TopLink]: ClientSession(7439747)--Connection(0)--acquire unit of work:514030
    [TopLink]: UnitOfWork(514030)--Connection(0)--JTS#register()
    [TopLink]: UnitOfWork(514030)--Connection(0)--JTS#beforeCompletion()
    [TopLink]: UnitOfWork(514030)--Connection(0)--JTS#afterCompletion()
    [TopLink]: UnitOfWork(514030)--Connection(0)--release unit of work
    [TopLink]: ClientSession(7439747)--Connection(0)--client released
    [TopLink]: ServerSession(529044)--Connection(0)--client acquired
    [TopLink]: ClientSession(7459637)--Connection(0)--acquire unit of work:2853878
    [TopLink]: UnitOfWork(2853878)--Connection(0)--JTS#register()
    [TopLink]: UnitOfWork(2853878)--Connection(0)--JTS#beforeCompletion()
    [TopLink]: UnitOfWork(2853878)--Connection(0)--JTS#afterCompletion()
    [TopLink]: UnitOfWork(2853878)--Connection(0)--release unit of work
    [TopLink]: ClientSession(7459637)--Connection(0)--client released
    [TopLink]: UnitOfWork(137003)--Connection(0)--JTS#beforeCompletion()
    [TopLink]: UnitOfWork(137003)--Connection(0)--JTS#afterCompletion()
    [TopLink]: UnitOfWork(137003)--Connection(0)--release unit of work
    [TopLink]: ClientSession(4134178)--Connection(0)--client released
    AprÞs ajout : Voitures du client :
    ***cmp test client 11/07***cmp test voiture 11/07
    cmp test voiture 11/07
    Fin des voitures du client ***cmp test client 11/07***
    and for the third, it really doesn't make any sense :
    [TopLink]: ServerSession(529044)--Connection(1303940)--SELECT NOM, IDCLIENT FROM CLIENT WHERE (IDCLI
    ENT = 33)
    [TopLink]: ServerSession(529044)--Connection(5198675)--SELECT NOM, IDVOITURE FROM VOITURE WHERE (IDV
    OITURE = 1904952)
    [TopLink]: ServerSession(529044)--Connection(0)--client acquired
    [TopLink]: ClientSession(6781636)--Connection(0)--acquire unit of work:7299944
    [TopLink]: UnitOfWork(7299944)--Connection(0)--JTS#register()
    [TopLink]: ServerSession(529044)--Connection(4416857)--SELECT t1.NOM, t1.IDVOITURE FROM CLIENT_VOITU
    RE t0, VOITURE t1 WHERE ((t0.IDCLIENT = 33) AND (t1.IDVOITURE = t0.IDVOITURE))
    [TopLink]: ServerSession(529044)--Connection(0)--client acquired
    [TopLink]: ClientSession(5916683)--Connection(0)--acquire unit of work:1460260
    [TopLink]: UnitOfWork(1460260)--Connection(0)--JTS#register()
    [TopLink]: UnitOfWork(1460260)--Connection(0)--JTS#beforeCompletion()
    [TopLink]: UnitOfWork(1460260)--Connection(0)--JTS#afterCompletion()
    [TopLink]: UnitOfWork(1460260)--Connection(0)--release unit of work
    [TopLink]: ClientSession(5916683)--Connection(0)--client released
    [TopLink]: UnitOfWork(7299944)--Connection(0)--JTS#beforeCompletion()
    [TopLink]: UnitOfWork(7299944)--Connection(0)--JTS#afterCompletion()
    [TopLink]: UnitOfWork(7299944)--Connection(0)--release unit of work
    [TopLink]: ClientSession(6781636)--Connection(0)--client released
    Avant ajout : Voitures du client :
    ***cmp test client 11/07***cmp test voiture 11/07
    Fin des voitures du client ***cmp test client 11/07***
    [TopLink]: ServerSession(529044)--Connection(0)--client acquired
    [TopLink]: ClientSession(6791004)--Connection(0)--acquire unit of work:7735671
    [TopLink]: UnitOfWork(7735671)--Connection(0)--JTS#register()
    [TopLink]: UnitOfWork(7735671)--Connection(0)--JTS#beforeCompletion()
    [TopLink]: UnitOfWork(7735671)--Connection(0)--JTS#afterCompletion()
    [TopLink]: UnitOfWork(7735671)--Connection(0)--release unit of work
    [TopLink]: ClientSession(6791004)--Connection(0)--client released
    [TopLink]: ServerSession(529044)--Connection(0)--client acquired
    [TopLink]: ClientSession(2463085)--Connection(0)--acquire unit of work:1100193
    [TopLink]: UnitOfWork(1100193)--Connection(0)--JTS#register()
    [TopLink]: ServerSession(529044)--Connection(0)--client acquired
    [TopLink]: ClientSession(1574247)--Connection(0)--acquire unit of work:4041918
    [TopLink]: UnitOfWork(4041918)--Connection(0)--JTS#register()
    [TopLink]: UnitOfWork(4041918)--Connection(0)--JTS#beforeCompletion()
    [TopLink]: UnitOfWork(4041918)--Connection(0)--JTS#afterCompletion()
    [TopLink]: UnitOfWork(4041918)--Connection(0)--release unit of work
    [TopLink]: ClientSession(1574247)--Connection(0)--client released
    [TopLink]: ServerSession(529044)--Connection(0)--client acquired
    [TopLink]: ClientSession(660080)--Connection(0)--acquire unit of work:517121
    [TopLink]: UnitOfWork(517121)--Connection(0)--JTS#register()
    [TopLink]: UnitOfWork(517121)--Connection(0)--JTS#beforeCompletion()
    [TopLink]: UnitOfWork(517121)--Connection(0)--JTS#afterCompletion()
    [TopLink]: UnitOfWork(517121)--Connection(0)--release unit of work
    [TopLink]: ClientSession(660080)--Connection(0)--client released
    [TopLink]: UnitOfWork(1100193)--Connection(0)--JTS#beforeCompletion()
    [TopLink]: UnitOfWork(1100193)--Connection(0)--JTS#afterCompletion()
    [TopLink]: UnitOfWork(1100193)--Connection(0)--release unit of work
    [TopLink]: ClientSession(2463085)--Connection(0)--client released
    AprÞs ajout : Voitures du client :
    ***cmp test client 11/07***cmp test voiture 11/07
    cmp test voiture 11/07
    Fin des voitures du client ***cmp test client 11/07***

  • EJB and many-to-many relationship

    I write two CMP Beans userBean and roleBean with many-to-many relationship
    userBean:
      cmp fields: id,name
      cmr fields: userRoles
    roleBean:
       cmp fields: id,rolename
       cmr fields: usersinroleIn database I have 3 tables:
    USER( ID NUMBER PK,NAME CHAR);
      ROLE( ID NUMBER PK,ROLENAME char);
      USER_ROLE( (USERID FK(USER.ID), ROLEID FK(ROLE.ID)) PK);in sun-cmp-mappings.xml I add cmp fields mapping,
    in userBean and roleBean I add secondary table USER_ROLE
    then I add CMR mappings to userBEan nd roleBean
    ufter deploying of EJB.jar
    in client i wrote:
    userBeanLocalHome lh=lookupUser();
    lh.create(new java.math.BigDecimal(5),'username');when i run client exception occurs in server log I see:
    TransactionRollbackException because Container try to insert into USER_ROLE
    values(5(userid),null(roleid)) but user have no roles
    in that situation how can I create user without any roles?
    thanx!

    FaraPooyan, I think about this but it is not good idea because it makes 1-n:1-m relationship.
    but I whant 0-n:0-m relationship
    I resolve this problem by removing secondary table from sun-cmp-entitymappings.xml
    So it works good, but now i dont understand: when i need secondary table mapping if they are not needed for many-to-many relationships

  • Many to many relationship EJB

    hi there,
    Do you know where to find an example of a project made with the developer studio using a many to many relation ship between EJB ?
    thanks,
    FM

    Frantz,
    unfortunately I don´t have a ready-to-use sample project. But this task is well documented at sap help. You need a helper table in your data dictionary to manage the relation.
    Check this link...
    SAP Help CMP
    Try to develop your own project and ask here if you have any issues.
    Regards
    Sebastian
    Message was edited by: Sebastian Voss

  • Many to Many Relationships in ejb.....Urgent Pls help

    hi all,
    Am working in EJB.Now we are coding for many to many relationship.
    Company and Salary register
    One Company can have many salary register and More than one company can have one salary register
    Companyand Salary register are the two tables having details of it.And the intermediate table having pk of company and salary register is Company_salary_register table,I want to add the value in this table having seperate interface.
    How to model it? I have given the add method of this company_salary_register table in company bean.I am getting the value of this one as collection.But it is asking me to add the values as the instance of LocalSalary(interfaceand entitybean).If i type cast it as Local Salary Class castexception occurs
    Please help me.Even Material of Modelling Many to Many relationship in EJB is enough.
    thanx in advance,

    THaaaaaanks alottt for the quick reply...
    I used the first way to insert the document and i was successful...
    but thing is that..
    when i do
    SQL>desc message_type
    message_type is NOT FINAL
    Name Null? Type
    SYS_XDBPD$ XDB.XDB$RAW_LIST_T
    to VARCHAR2(4000 CHAR)
    from VARCHAR2(4000 CHAR)
    subject VARCHAR2(4000 CHAR)
    body VARCHAR2(4000 CHAR)
    i can see the structure...
    and when i
    select count(*) from messages
    it says count is 1.
    so how to know where the data is ..like below in the data :
    'to' it has '[email protected]'
    and for 'from' it has '[email protected]'..and so on..
    <message>
    <to>[email protected]</to>
    <from>[email protected]</from>
    <subject>Question</subject>
    <body>Does this demo work?</body>
    </message>
    so what is the command to get that data...
    because when i do
    select * from message_type..it says
    select * from message_type
    ERROR at line 1:
    ORA-04044: procedure, function, package, or type is not allowed here
    Plss help me outt.......this will be my final step...
    Thankssssssssssssssss

  • Additional field in join table for CMP EJB

    Hello,
    I'm trying to perform this task using CMP entity beans:
    The entity A has a CMR relation of cardinality m-n with entity B (bidirectional) (This is working fine).
    I want to add a parameter to the relation.
    Ex : When I find that A1 is linked to B1, I need to perform "x" times an action. x would be my parameter, and I would have kept this parameter as an additional column in the join table A_TO_B.
    Could anyone provide an example of how to perform this with CMP EJB?
    NOTE: I'm using OC4J 10g 9.0.4 standalone (and cannot change my version).
    Thanks
    Tanguy

    Manohar,
    You need to create an append structure for table VBAP (for example ZAVBAP) using SE11. In this structure you create your ZZ fields. If you need a non-SAP domain/data element for your field then you need to create it first using the same transaction and activate it. Attach ZAVBAP to VBAP so the SE11 shows:
    .APPEND in the Fields column and
    ZAVBAP in the Field type column.
    Your ZZ fields will be shown automatically.
    When you have finished then activate your ZAVBAP structure. You will notice when you go VA01 (for example) that a lot of programs are being recompiled. Don't worry. It will be ok.
    The user-exit screen number for items is 8459 (in program SAPMV45A).
    Thanks,
    Wojtek

Maybe you are looking for