CMR in ejb 3.0

I am getting the following error :
Exception Description: Multiple writable mappings exist for the field [ENVINCIDE
NTS.INCIDENTS_ID]. Only one may be defined as writable, all others must be spec
ified read-only.
for the entity bean envincidents:
@Id
@Column(name="INCIDENTS_ID", primaryKey=true, nullable=false)
public Long getIncidentsId() {
return incidentsId;
public void setIncidentsId(Long incidentsId) {
this.incidentsId = incidentsId;
@Id
@ManyToOne(targetEntity="model.Incidents")
@JoinColumn(name="ENVINCIDENTS.INCIDENTS_ID", referencedColumnName="INCIDENTS.ID")
public Incidents getIncidents() {
return incidents;
public void setIncidents(Incidents incidents) {
this.incidents = incidents;
how do I make one of them read only.

If you are mapping the same field to two attributes then you will have this issue.
You basically need to make one of the mappings read-only and this write your model to handle this and keep the values consistent. I would modify your model as:
@Id
@Column(name="INCIDENTS_ID", primaryKey=true, nullable=false, updatable=false, insertable=false)
public Long getIncidentsId() {
return incidentsId;
public void setIncidentsId(Long incidentsId) {
this.incidentsId = incidentsId;
@Id
@ManyToOne(targetEntity="model.Incidents")
@JoinColumn(name="ENVINCIDENTS.INCIDENTS_ID", referencedColumnName="INCIDENTS.ID")
public Incidents getIncidents() {
return incidents;
public void setIncidents(Incidents incidents) {
this.incidents = incidents;
setIncidentsId(incidents.getId());
}Note that the Basic mapping is qualified with updatable=false and insertable=false. These settings are equiavlent to TopLink's read-only setting on a mapping.
I hope this helps,
Doug

Similar Messages

  • CMR between EJBs in different JARs

    Hi,
    how could I manage CMR between EJBs in different JAR-files (different deplyoment descriptors as well) ?
    THX
    Tim

    Hi Tim, You should post this question to EJB newsgroup not JNDI.
    The answer though is you cannot, please see this documentation,
    http://edocs.bea.com/wls/docs81/ejb/entity.html#1188656

  • Ejb 3.0 on OC4J preview 4 CMR is this a BUG

    Exception [TOPLINK-48] (Oracle TopLink - 10g release 3 (10.1.3.0.0) (Build 05091
    2)): oracle.toplink.exceptions.DescriptorException
    Exception Description: Multiple writable mappings exist for the field [ENVINCIDE
    NTS.INCIDENTS_ID]. Only one may be defined as writable, all others must be spec
    ified read-only.
    Mapping: oracle.toplink.mappings.OneToOneMapping[incidents]
    Descriptor: RelationalDescriptor(model.Envincidents --> [DatabaseTable(ENVINCIDE
    NTS)])
    as I understand the CMR uses toplink somewhere under the hood.
    from the docs I got this...
    @OneToMany(cascade=PERSIST)
    @JoinColumn(name="MANAGER_ID", referencedColumnName="EMP_ID")
    public Collection getManagedEmployees() {
    return managedEmployees;
    TopLink defaults and equivalent code
    OneToManyMapping mapping = new OneToManyMapping();
    mapping.setIsReadOnly(false);
    mapping.setIsPrivateOwned(false);
    mapping.setAttributeName(attributeName);
    mapping.setReferenceClass(referenceClass);
    in Toplink mapping there is setIsReadOnly() but how do
    I specify this in ejb 3.0 annotations. I get the above error
    whenever I use any sort of relationship in my ejbs and have the
    same column defined as primary key in the table.

    Take a look at this forum Re: CMR in ejb 3.0
    You basically need to make one of your mappings as read-only and I would recommend doing it with your basic mapping as it is easier to maintain with the set of the @ManyToOne relationship.
    Doug

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

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

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

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

  • Unidirectional one-to-many CMR in OC4J 9.0.3.1699

    Hi,
    I have the following issue with the new (productiv) OC4J 9.0.3 build 020927.1699, with did not occur with
    build 020725.1695. I would like to deploy local entity beans CMRDepartment -1--n-> CMREmployee with container managed relations. Here's the relation part of ejb-jar.xml
    <ejb-relation>
    <ejb-relation-name>theEmployees2theDepartment</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>theEmployees</ejb-relationship-role-name>
    <multiplicity>Many</multiplicity>
    <relationship-role-source>
    <ejb-name>CMREmployee</ejb-name>
    </relationship-role-source>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>theDepartment</ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>CMRDepartment</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>theEmployees</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    Now the problem is that the depoyment generates an database table CMREmployee_cmrtest_cmrtest for CMR with a foreign key column CMRDepartment_theEmployees referencing the CMRDepartment_cmrtest_cmrtest table for the CMRDepartment bean, even though the relation is not navigable from Emp to Dept. Is this a bug or a feature? Here's the CMREmployee part of the orion-ejb-jar.xml after deployment:
              <entity-deployment name="CMREmployee" location="CMREmployee" wrapper="CMREmployeeHome_EntityHomeWrapper27" local-wrapper="CMREmployeeLocalHome_EntityHomeWrapper16" table="CMREmployee_cmrtest_cmrtest" data-source="jdbc/OracleDS" exclusive-write-access="false" locking-mode="optimistic" update-changed-fields-only="true" delay-updates-until-commit="true" min-instances-per-pk="0" max-instances-per-pk="50" disable-wrapper-cache="true">
                   <primkey-mapping>
                        <cmp-field-mapping name="id" persistence-name="id" />
                   </primkey-mapping>
                   <cmp-field-mapping name="name" persistence-name="name" />
                   <cmp-field-mapping name="theAddress">
                        <entity-ref home="CMRAddress">
                             <cmp-field-mapping name="theAddress" persistence-name="theAddress" />
                        </entity-ref>
                   </cmp-field-mapping>
                   <cmp-field-mapping name="CMRDepartment_theEmployees">
                        <entity-ref home="CMRDepartment">
                             <cmp-field-mapping name="CMRDepartment_theEmployees" persistence-name="CMRDepartment_theEmployees" />
                        </entity-ref>
                   </cmp-field-mapping>
                   <cmp-field-mapping name="theProjects">
                        <collection-mapping table="CMRProject_CMREmployee__1ftrph">
                             <primkey-mapping>
                                  <cmp-field-mapping name="CMREmployee_id">
                                       <entity-ref home="CMREmployee">
                                            <cmp-field-mapping name="CMREmployee_id" persistence-name="CMREmployee_id" />
                                       </entity-ref>
                                  </cmp-field-mapping>
                             </primkey-mapping>
                             <value-mapping type="cmrtest.CMRProjectLocal">
                                  <cmp-field-mapping name="CMRProject_id">
                                       <entity-ref home="CMRProject">
                                            <cmp-field-mapping name="CMRProject_id" persistence-name="CMRProject_id" />
                                       </entity-ref>
                                  </cmp-field-mapping>
                             </value-mapping>
                        </collection-mapping>
                   </cmp-field-mapping>
                   <finder-method>
                        <!-- Generated SQL: "SELECT o.id FROM CMREmployee_cmrtest_cmrtest o -->
                        <method>
                             <ejb-name>CMREmployee</ejb-name>
                             <method-name>findAllInstances</method-name>
                             <method-params>
                             </method-params>
                        </method>
                   </finder-method>
                   <ejb-ref-mapping name="ejb/references/theAddress/CMRAddressLocal" />
                   <ejb-ref-mapping name="ejb/references/theProjects/CMRProjectLocal" />
                   <resource-ref-mapping name="jdbc/EJBDataSource" />
                   <resource-ref-mapping name="jms/EJBQueueConnectionFactory" />
                   <resource-ref-mapping name="jms/EJBTopicConnectionFactory" />
                   <resource-env-ref-mapping name="jms/EJBQueue" />
                   <resource-env-ref-mapping name="jms/EJBTopic" />
              </entity-deployment>
    Any hints would be very wellcome.
    Regards
    Stefan

    Trond,
    when ou deploy your application, you should not need to include the orion-ejb-jar.xml.
    Also, if you have previously deployed the application, delete the application directory UNDER both applicatopn-deployments and applications. The directory will be your application's name.
    Hope this helps,
    Rob Cole
    Oracle

  • Ejb 3.0 and JDeveloper

    If I drag and drop tables with One to one mapping in an ejb diagram in JDeveloper (one table have having the foreign key as the primary key). If I create ejb 2.1 beans it makes makes a One To One mapping between the entity beans created and if I drop them as ejb 3.0 it makes a OneToMany mapping. this is what I get for the same tables.
    for ejb 2.1
    <ejb-relation>
    <ejb-relation-name>Envincidents - Incidents</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>Envincidents has one Incidents</ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>Envincidents</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>incidents_incidentsId</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>Incidents may have one Envincidents</ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>Incidents</ejb-name>
    </relationship-role-source>
    </ejb-relationship-role>
    </ejb-relation>
    for ejb 3.0
    Envincidents
    @Id
    @ManyToOne(targetEntity="mypackage.Incidents")
    @JoinColumn(name="ENVINCIDENTS.INCIDENTS_ID", referencedColumnName="INCIDENTS.ID")
    public Incidents getIncidents() {
    return incidents;
    public void setIncidents(Incidents incidents) {
    this.incidents = incidents;
    Incidents
    @OneToMany(targetEntity="mypackage.Envincidents")
    @JoinColumn(name="ENVINCIDENTS.INCIDENTS_ID", referencedColumnName="INCIDENTS.ID")
    public Collection<Envincidents> getEnvincidentsCollection() {
    return envincidentsCollection;
    public void setEnvincidentsCollection(Collection<Envincidents> envincidentsCollection) {
    this.envincidentsCollection = envincidentsCollection;
    public Envincidents addToEnvincidentsCollection(Envincidents envincidents) {
    getEnvincidentsCollection().add( envincidents );
    envincidents.setIncidents( this );
    return envincidents;
    public Envincidents removeFromEnvincidentsCollection(Envincidents envincidents) {
    getEnvincidentsCollection().remove( envincidents );
    envincidents.setIncidents( null );
    return envincidents;
    this causes the following problem.
    Exception Description: Multiple writable mappings exist for the field [ENVINCIDE
    NTS.INCIDENTS_ID]. Only one may be defined as writable, all others must be spec
    ified read-only.
    which I have already reported.
    I know this is a minor inconvenience and I can hand edit the entity beans and make them one to one for ejb 3.0. But would be to good advantage to have a consistent "dropping of tables" for ejb 2.1 and 3.0. So one can have a similar behavior of entity beans created from tables using ejb 2.1 and 3.0.

    I guess this could be desirable if migrating from ejb 2.1 to 3.0 if one has already designed the database.
    Dev

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

  • CMR and Local Interfaces

    I have a question on setting up CMR in an environment where I want to utilize local
    interfaces within a weblogic server instance. In the deployment descriptor, I have
    set up the home, remote, local-home, local, and ejb-class entries. I then want to
    define the relationships between two CMP entity beans. Here is where I run into
    problems.
    1) If I define the CMR field using the local interface, I get an error stating that
    the type defined by the bean for the field does not match that of the remote interface.
    2) If I define the CMR field using the remote interface, I get an error stating that
    the bean must use the local interface for the CMR if one exists.
    Seems kind of circular to me. What am I missing?

    If you want to be able to have mutiple children companies for a parent
    company and you want to be able to query for the parent company for a given
    comapnay then this is the XML I would do something like the following. In
    your xml you had the mutiplicities inverted and also the cmr field was
    either in the wrong place or misnamed (ie, if it had to be in the top block
    then it should have been "childCompanies" instead of "parentCompany").
    Assuming the bean name in the descriptor for the CompanyEJB is Company:
    <ejb-relation>
    <ejb-relation-name>Company-ParentCompany</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>Company-Has-ChildCompanies</ejb-relationship-rol
    e-name>
    <multiplicity>one</multiplicity>
    <relationship-role-source>
    <ejb-name>Company</ejb-name>
    </relationship-role-source>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>Company-Has-ParentCompany</ejb-relationship-role
    -name>
    <multiplicity>many</multiplicity>
    <relationship-role-source>
    <ejb-name>Company</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>parentCompany</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    In the CompanyEJB you would have:
    public abstract CompanyLocal getParentCompany();
    public abstract void setParentCompany( CompanyLocal parent );
    -- Anand
    "Steve Ebersole" <[email protected]> wrote in message
    news:[email protected]...
    >
    The jar I am running through ejbc is attached (with source). The EJBobject naming
    conventions are as follows:
    ejb-class = CompanyEJB
    home = CompanyHome
    remote = Company
    local-home = CompanyLocalHome
    local = CompanyLocal
    The pertinent ejb-jar snippet:
    <ejb-relation>
    <ejb-relation-name>Company-ParentCompany</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>Company-Has-ChildCompanies</ejb-relationship-rol
    e-name>
    <multiplicity>Many</multiplicity>
    <relationship-role-source>
    <ejb-name>Company</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>parentCompany</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>Company-Has-ParentCompany</ejb-relationship-role
    -name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>Company</ejb-name>
    </relationship-role-source>
    </ejb-relationship-role>
    </ejb-relation>
    And the weblogic-cmp-rdbms-jar snippet:
    <weblogic-rdbms-relation>
    <relation-name>Company-ParentCompany</relation-name>
    <weblogic-relationship-role>
    <relationship-role-name>Company-Has-ParentCompany</relationship-role-name>
    </weblogic-relationship-role>
    <weblogic-relationship-role>
    <relationship-role-name>Company-Has-ChildCompanies</relationship-role-name>
    <column-map>
    <foreign-key-column>PRNT_COMP_ID</foreign-key-column>
    <key-column>COMP_ID</key-column>
    </column-map>
    </weblogic-relationship-role>
    </weblogic-rdbms-relation>
    In the CompanyEJB, these are the two scenarios I tried:
    1)
    public abstract Company getParentCompany();
    public abstract void setParentCompany( Company prnt );
    2)
    public abstract CompanyLocal getParentCompany();
    public abstract void setParentCompany( CompanyLocal prnt );
    The only way I have been able to get it to work so far is to use thesyntax in #1
    above and then to remove all references to the local interfaces in thedeployment
    descriptors.
    Thanks for all help

  • CMR 2.0 in 10.1.2.2.0

    I have a one to many relation between two tables...
    My xdoclet lookes like this in the two tables
    * This is a bi-directional one-to-many relationship CMR method
    * @return a java.util.Collection
    * @ejb.interface-method
    * view-type="local"
    * @ejb.relation
    * name="SAMTALEUDTRREGLER-SAMTALETYPER_SAMTALEUDTRREGLER"
    * role-name="SAMTALEUDTRREGLER-has-SAMTALETYPER_SAMTALEUDTRREGLER"
    * cascade-delete="no"
    * target-ejb="ejb/SamtaleTyper_SamtaleUdtrRegler"
    public abstract java.util.Collection getSamtaleType_SamtaleUdtrRegler();
    * This is a bi-directional one-to-many relationship CMR method
    * @return a java.util.Collection
    * @ejb.interface-method
    * view-type="local"
    * @ejb.relation
    * name="SAMTALEUDTRREGLER-SAMTALETYPER_SAMTALEUDTRREGLER"
    * role-name="SAMTALETYPER_SAMTALEUDTRREGLER-has-SAMTALEUDTRREGLER"
    * target-multiple="yes"
    * cascade-delete="yes"
    public abstract dk.modulus.afi.ientity.SamtaleUdtrReglerLocal getSamtaleUdtrRegel();
    Generated deployment discriptor.....
    <relationships >
    <ejb-relation >
    <ejb-relation-name>SAMTALEUDTRREGLER-SAMTALETYPER_SAMTALEUDTRREGLER</ejb-relation-name>
    <ejb-relationship-role > <ejb-relationship-role-name>SAMTALETYPER_SAMTALEUDTRREGLER-has-SAMTALEUDTRREGLER</ejb-relationship-role-name>
    <multiplicity>Many</multiplicity>
    <cascade-delete/>
    <relationship-role-source >
    <ejb-name>ejb/SamtaleTyper_SamtaleUdtrRegler</ejb-name>
    </relationship-role-source>
    <cmr-field >
    <cmr-field-name>samtaleUdtrRegel</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role >
    <ejb-relationship-role-name>SAMTALEUDTRREGLER-has-SAMTALETYPER_SAMTALEUDTRREGLER</ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source >
    <ejb-name>ejb/SamtaleUdtrRegler</ejb-name>
    </relationship-role-source>
    <cmr-field >
    <cmr-field-name>samtaleType_SamtaleUdtrRegler</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    </relationships>
    And some of the generated orion-ejb-jar.xml
    <primkey-mapping>
    <cmp-field-mapping name="samtaleUdtrRegel">
    <entity-ref home="ejb/SamtaleUdtrRegler">
    <cmp-field-mapping name="samtaleUdtrRegel">
    <fields>
                                            <cmp-field-mapping name="samtaleUdtrRegelID" persistence-name="samtaleUdtrRegel_samta__s8nl4g" />
                                                 </fields>
    </cmp-field-mapping>
    </entity-ref>
    </cmp-field-mapping>
    </primkey-mapping>
    <!-- Generated SQL (all columns): "select SAMTALETYPER_SAMTALEUDTRREGLER.SAMTALETYPE, SAMTALETYPER_SAMTALEUDTRREGLER.SAMTALEUDTRREGEL_ID, SAMTALETYPER_SAMTALEUDTRREGLER.FRADATO, SAMTALETYPER_SAMTALEUDTRREGLER.TILDATO, SAMTALETYPER_SAMTALEUDTRREGLER.BATCHDATO, SAMTALETYPER_SAMTALEUDTRREGLER.OPRETDATO, SAMTALETYPER_SAMTALEUDTRREGLER.OPRETTET_AF, SAMTALETYPER_SAMTALEUDTRREGLER.RETDATO, SAMTALETYPER_SAMTALEUDTRREGLER.RETTET_AF, SAMTALETYPER_SAMTALEUDTRREGLER.OPRETTET_MED, SAMTALETYPER_SAMTALEUDTRREGLER.OPDATERINGSSEKVENS, SAMTALETYPER_SAMTALEUDTRREGLER.samtaleUdtrRegel_samta__s8nl4g from SAMTALETYPER_SAMTALEUDTRREGLER -->
    so, when I try to use the cmr i get this error....
    08/02/15 08:41:19 javax.ejb.EJBException: nested exception is: javax.ejb.EJBException: Database error: ORA-00904: "SAMTALETYPER_SAMTALEUDTRREGLER"."SA
    MTALEUDTRREGEL_SAMTA__S8NL4G": invalid identifier
    ; nested exception is: java.sql.SQLException: ORA-00904: "SAMTALETYPER_SAMTALEUDTRREGLER"."SAMTALEUDTRREGEL_SAMTA__S8NL4G": invalid identifier
    08/02/15 08:41:19 javax.ejb.EJBException: Database error: ORA-00904: "SAMTALETYPER_SAMTALEUDTRREGLER"."SAMTALEUDTRREGEL_SAMTA__S8NL4G": invalid identi
    fier
    ; nested exception is: java.sql.SQLException: ORA-00904: "SAMTALETYPER_SAMTALEUDTRREGLER"."SAMTALEUDTRREGEL_SAMTA__S8NL4G": invalid identifier
    08/02/15 08:41:19 java.sql.SQLException: ORA-00904: "SAMTALETYPER_SAMTALEUDTRREGLER"."SAMTALEUDTRREGEL_SAMTA__S8NL4G": invalid identifier
    08/02/15 08:41:19 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:137)
    08/02/15 08:41:19 at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:304)
    08/02/15 08:41:19 at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:271)
    Anybody got an suggestion ????
    Kris

    It seems your problem depends on the data model,
    ensure that the db objects exists already and user has permissions and other required roles which ones can reach the objects, also may be required synonyms.
    so you get ORA exception, you must look at db to solve this problem.
    Mucahid Uslu

  • OC4J EJBQL and EJB 2.0 features

    Hello Debu Panda and All
    I've got all howtos and I mangaged to get some parts of OC4J [Oracle9iAS (9.0.3.0.0) Containers for J2EE (build 020323.1689)] working.
    There are still some issues that are stalling our development. Could you please comment on them, maybe providing an estimate of when they will be solved/implemented?
    First of all, a little background. Our application uses many Java Swing application clients that connect to the EAR application in the container.
    The ear application has the following structure:
    All database access (Oracle 8i, located in its own server) is done exclusively by means of CMP entity beans. A entity bean may access other entity beans. There are workflow session beans (stateful and stateless) that access the entity beans. All clients see only the workflow session beans (session beans fagade).
    Our applicatoin is complex, having more than 80 session beans and more than 25 entity beans (not counting entity beans that exist only to represent relationships among entity beans).
    There goes the questions:
    1) It seems that entity beans cannot currently be referenced by remote interfaces. We couldn't deploy our application using it. Since we could use only local interfaces fot entity beans, thats what is been done now.
    2) There is no CMR supported. Is this true?
    3) EJBQL seems to be very limited. In the howto examples there are EJBQL statements that compare two numbers. However, when we tried to use String comparisons, it didn't work. Here is the statement:
    "SELECT DISTINCT OBJECT(p) FROM Person p WHERE p.name = ?1"
    If I compile, package and deploy the ear applicatin with the above EJBQL statement, OC4J generates an exception when executing the finder method. The exception is:
    "java.rmi.NoSuchObjectException: Session has timed out
    at com.evermind.server.ejb.StatefulSessionEJBObject.throwPassivisat
    ception(StatefulSessionEJBObject.java:188)
    at Cad023Remote_StatefulSessionBeanWrapper0.obterPessoasPorParteNom
    023Remote_StatefulSessionBeanWrapper0.java:754)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:8
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:64)"
    If I remove the where clause, the expection is gone. However, I get all records. ;-)
    4) It seems that all EJBQL clauses must be capitalized. Is this true?
    FINALY)
    Is there a newer OC4J build that could use to get the development going? Do you know where there will be one? Is there any way of contacting the OC4J development team to report bugs?
    If you would like, we could discuss it in private e-mail (please use my private mail [email protected]).
    Thanks for your attention,
    Luis Fernando Soeiro
    Hi !! OC4J 9.0.3 developer's preview has most features of EJB 2.0. We are working on updating on our docs and samples for EJB 2.0
    Please look at the following URL that has some How Tos on EJB 2.0 features such Local Interfacea, EJB QL, etc : http://otn.oracle.com/tech/java/oc4j/htdocs/oc4j-how-to.html#ejb
    regards
    Debu Panda
    Oracle --------------------------
    Luis Soeiro <mailto:[email protected]> <mailto:[email protected]>Type : Question Date : Apr 11, 2002 15:15 PT Hello
    Some colleagues and I are trying to port a large project from JBOSS to OC4J. We used JBOSS 3.0 (beta) in order to evaluate EJB2.0 features and see if we could use it. We already have OC4J in production, but only as a JSP/Servlet container. The next step would be to deploy our EJB application to OC4J.
    We have read the material and it is written that OC4J (developers preview) is EJB 2.0 compliant. However, the specific documentation and the examples don't show how to specify OC4J specifc XML files. We absolutely need CMR and Local Interfaces, because we don't have the time required to downgrade our JBoss EJB2.0 application to the EJB 1.1 specification. We have over 80 Session Beans and over 20 Entity Beans.
    Is there anybody there that can confirm that OC4J developer's preview is really EJB2.0 compliant? If so, could you send me some pointers to information about OC4J container specifc deployment descriptors? The docs listed at the web site don't have EJB2.0 features listed, nor does the Oracle samples.
    Thanks for your attention,
    desperately,
    Luis Fernando Soeiro

    HI,
    I worked out CMR and EJB-QL with single bean.
    Using CMR, it is possible to get one bean reference through other bean, but
    When I tried EJB-QL with bean to bean navigation then I run into problem.

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

  • When i add CMR between 2 CMP, it show ORA-00904

    i create 2 "CMP from table" without foreign key. i can create both instance by home.create() . after i add CMR between both. i can create master but can't create detail. when i create the detail, it show ORA-00904.
    anyone can help me?
    master table is
    CREATE TABLE KAY_TMP_1 (
    ID VARCHAR2 (2) NOT NULL,
    KAY_NUM NUMBER (9,2),
    KAY_NAME VARCHAR2 (10),
    KAY_DATE DATE,
    PRIMARY KEY ( ID ) ) ;
    detail table is
    CREATE TABLE KAY_TMP_2 (
    ID2 VARCHAR2 (2) NOT NULL,
    SUB_ID2 VARCHAR2 (2) NOT NULL,
    KAY_NAME2 VARCHAR2 (10),
    PRIMARY KEY ( ID2, SUB_ID2 ) ) ;
    ejb-jar.xml
    <?xml version = '1.0' encoding = 'GBK'?>
    <!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>Kay_tmp_2</display-name>
    <ejb-name>Kay_tmp_2</ejb-name>
    <home>fehd.web.util.Kay_tmp_2Home</home>
    <remote>fehd.web.util.Kay_tmp_2</remote>
    <local-home>fehd.web.util.Kay_tmp_2LocalHome</local-home>
    <local>fehd.web.util.Kay_tmp_2Local</local>
    <ejb-class>fehd.web.util.impl.Kay_tmp_2Bean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>fehd.web.util.Kay_tmp_2PK</prim-key-class>
    <reentrant>False</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>Kay_tmp_2</abstract-schema-name>
    <cmp-field>
    <field-name>id2</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>sub_id2</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>kay_name2</field-name>
    </cmp-field>
    </entity>
    <entity>
    <description>Entity Bean ( CMP )</description>
    <display-name>Kay_tmp_1</display-name>
    <ejb-name>Kay_tmp_1</ejb-name>
    <home>fehd.web.util.Kay_tmp_1Home</home>
    <remote>fehd.web.util.Kay_tmp_1</remote>
    <local-home>fehd.web.util.Kay_tmp_1LocalHome</local-home>
    <local>fehd.web.util.Kay_tmp_1Local</local>
    <ejb-class>kaytmp.Kay_tmp_1Bean</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>Kay_tmp_1</abstract-schema-name>
    <cmp-field>
    <field-name>id</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>kay_num</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>kay_name</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>kay_date</field-name>
    </cmp-field>
    <primkey-field>id</primkey-field>
    </entity>
    <relationships>
    <ejb-relation>
    <ejb-relation-name>kayTmp1_kayTmp2</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>kayTmp1-have-many-KayTmp2</ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <cascade-delete/>
    <relationship-role-source>
    <ejb-name>Kay_tmp_1</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>kayTmp2</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <multiplicity>Many</multiplicity>
    <relationship-role-source>
    <ejb-name>Kay_tmp_2</ejb-name>
    </relationship-role-source>
    </ejb-relationship-role>
    </ejb-relation>
    </relationships>
    </ejb-jar>
    orion-ejb-jar.xml
    <?xml version = '1.0' encoding = 'GBK'?>
    <!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="Kay_tmp_1" copy-by-value="false" data-source="jdbc/iasdbDS" exclusive-write-access="false" table="KAY_TMP_1">
    <primkey-mapping>
    <cmp-field-mapping name="id" persistence-name="ID" persistence-type="VARCHAR2(2)"/>
    </primkey-mapping>
    <cmp-field-mapping name="id" persistence-name="ID" persistence-type="VARCHAR2(2)"/>
    <cmp-field-mapping name="kay_num" persistence-name="KAY_NUM" persistence-type="NUMBER(9,2)"/>
    <cmp-field-mapping name="kay_name" persistence-name="KAY_NAME" persistence-type="VARCHAR2(10)"/>
    <cmp-field-mapping name="kay_date" persistence-name="KAY_DATE" persistence-type="DATE"/>
    </entity-deployment>
    <entity-deployment name="Kay_tmp_2" copy-by-value="false" data-source="jdbc/iasdbDS" exclusive-write-access="false" table="KAY_TMP_2">
    <primkey-mapping>
    <cmp-field-mapping>
    <fields>
    <cmp-field-mapping name="id2" persistence-name="ID2" persistence-type="VARCHAR2(2)"/>
    <cmp-field-mapping name="sub_id2" persistence-name="SUB_ID2" persistence-type="VARCHAR2(2)"/>
    </fields>
    </cmp-field-mapping>
    </primkey-mapping>
    <cmp-field-mapping name="id2" persistence-name="ID2" persistence-type="VARCHAR2(2)"/>
    <cmp-field-mapping name="sub_id2" persistence-name="SUB_ID2" persistence-type="VARCHAR2(2)"/>
    <cmp-field-mapping name="kay_name2" persistence-name="KAY_NAME2" persistence-type="VARCHAR2(10)"/>
    </entity-deployment>
    </enterprise-beans>
    <assembly-descriptor>
    <default-method-access>
    <security-role-mapping impliesAll="true" name="&lt;default-ejb-caller-role>"/>
    </default-method-access>
    </assembly-descriptor>
    </orion-ejb-jar>

    Have a look at the orion-ejb-jar.xml which is generated by oc4j in the application-deployments dir.
    Oc4j takes your orion-ejb-jar.xml and generates its own basing on your version.
    In the generated file you should be able to see the select statements which will be executed.

  • EJB transaction question in ejbCreate

    I have 2 Entity EJBs participating in an relationship. Order - LineItem. I'm creating the LineItem in the the ejbPostCreate of Order.
    When I encountered a duplicate key for Order in Order's ejbCreate, I was not expecting the LineItem to be created, I thought a rollback would occur.
    What do I need to do to ensure a rollback occurs. And it looks like the container called ejbPostCreate even though ejbCreate threw an exception. Can I get around this?
    thanks in advance!

    I'll post an simple one to many relation ship example..
    order table:
    orderPK int
    orderId int
    line item table:
    lineItemPK int
    lineItemId int
    orderId int
    abstract PModel
    public abstract class OrderBean implements EntityBean
    public Collection getLineItems();
    public void setLineItems(Collection lineItems);
    publi interface LineItemLocal extends EJBLocalObject
    public Integer getLineItem();
    public void setLineItem(Integere value);
    bean class for LineItem
    public class LineItemBean implements EntityBean
    public Inbteger ejbCreate(Integer lineItem)
    setLineItem(lineItem);
    return null;
    public void ejbPostCreate(Intger lineItem)
    public abstract Integer getId();
    public abstract Integer setId();
    //entity bean methods
    public abstract class OrderBean implements EntityBean
    public void addLineItem(Integer lineItem)
    InitialContext cntx=new InitialContext();
    LineItemHomeLocal lineItemHome=cntx.lookup("LineItemHomeLocal");
    lineItemLocal lineItemLocal=lineItemHome.create(lineItem);
    Collection lineItems=this.getLineItems();
    lineItems.add(lineItemLoacl);
    schema defnition:
    <relationships>
    <ejb-relation>
    <ejb-relation-name>Order-LineItems</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>orderHasLineitem</ejb-relationship-role-name>
    <mutiplicity>one</multiplicity>
    <relationship-role-source>OredrBean</relationship-role-source>
    <cmr-field>
    <cmr-field-name>lineItems</cmr-field-name>
    <cmr-field-type>Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>LineItembelongstooredr</ejb-relationship-role-name>
    <mutiplicity>many</multiplicity>
    <relationship-role-source>LineItemBean</relationship-role-source>
    </ejb-relationship-role>
    </ejb-relation>
    </relationships>

  • A cmr-field and a cmp-field on the bean are using the same name. The names

    Hi:
    I am using weblogic 8.1 and MyEclipse 5.1.1. I am deploying my ear application through MyEclipse 5.1.1 as an ear file.
    When I ran the following EJB QL:
    SELECT OBJECT(p) FROM Product p.category = ?1
    I get the following error:
    n relation Category-Product, a cmr-field and a cmp-field on the bean are using the same name. The names of cmr and cmp fields must be unique.
    It is basically complaining that I have a field
    <cmr-field>
                             <cmr-field-name>category</cmr-field-name>
                        </cmr-field>
    in my ejb-jar.xml and also the same category in the
    <cmp-field><field-name>category</field-name></cmp-field>
    field. The problem is that if I changed the value of the cmr-field, I have to add a get and set in my productLocal.java and when you do that you have to do the same in the ejb-jar.xml.
    Here is my ejb-jar.xml:
    <?xml version="1.0"?>
    <!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>
    <ejb-name>CategoryEJB</ejb-name>
    <local-home>com.CategoryHomeLocal</local-home>
    <local>com.CategoryLocal</local>
    <ejb-class>com.CategoryBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.Integer</prim-key-class>
    <reentrant>False</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>Category</abstract-schema-name>
         <cmp-field><field-name>categoryId</field-name></cmp-field>
    <cmp-field><field-name>categoryName</field-name></cmp-field>
    <cmp-field><field-name>picture</field-name></cmp-field>
    <cmp-field><field-name>pictureWidth</field-name></cmp-field>
    <cmp-field><field-name>pictureHeight</field-name></cmp-field>
    <cmp-field><field-name>labelOn</field-name></cmp-field>
         <cmp-field><field-name>labelOff</field-name></cmp-field>
         <cmp-field><field-name>button</field-name></cmp-field>
    <primkey-field>categoryId</primkey-field>
    <security-identity><use-caller-identity/></security-identity>
              <query>
                   <query-method>
                        <method-name>findCategory</method-name>
                        <method-params></method-params>
                   </query-method>
                   <ejb-ql>
                        SELECT OBJECT(c) FROM Category c
                   </ejb-ql>
              </query>
         </entity>
         <entity>
    <ejb-name>ProductEJB</ejb-name>
    <local-home>com.ProductHomeLocal</local-home>
    <local>com.ProductLocal</local>
    <ejb-class>com.ProductBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.Integer</prim-key-class>
    <reentrant>False</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>Product</abstract-schema-name>
         <cmp-field><field-name>productId</field-name></cmp-field>
    <cmp-field><field-name>brandName</field-name></cmp-field>
    <cmp-field><field-name>productDescription</field-name></cmp-field>
    <cmp-field><field-name>purchasePrice</field-name></cmp-field>
    <cmp-field><field-name>category</field-name></cmp-field>
    <primkey-field>productId</primkey-field>
    <security-identity><use-caller-identity/></security-identity>
              <query>
                   <query-method>
                        <method-name>findProduct</method-name>
                        <method-params>
                        <method-param>com.CategoryLocal</method-param>
                        </method-params>
                   </query-method>
                   <ejb-ql>
                        SELECT OBJECT(p) FROM Product p.category = ?1
                   </ejb-ql>
              </query>
         </entity>
    </enterprise-beans>
    <relationships>
                   <ejb-relation>
                   <ejb-relation-name>Category-Product</ejb-relation-name>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>
                             Category-has-many-Product-numbers
                        </ejb-relationship-role-name>
                        <multiplicity>one</multiplicity>
                        <relationship-role-source>
                             <ejb-name>CategoryEJB</ejb-name>
                        </relationship-role-source>
                        <cmr-field>
                             <cmr-field-name>productNumbers</cmr-field-name>
                             <cmr-field-type>java.util.Collection</cmr-field-type>
                        </cmr-field>
                   </ejb-relationship-role>
                   <ejb-relationship-role>
                        <ejb-relationship-role-name>
                             Product-belongs-to-Category
                        </ejb-relationship-role-name>
                        <multiplicity>many</multiplicity>
                        <cascade-delete/>
                        <relationship-role-source>
                             <ejb-name>ProductEJB</ejb-name>
                        </relationship-role-source>
                        <cmr-field>
                             <cmr-field-name>category</cmr-field-name>
                        </cmr-field>
                   </ejb-relationship-role>
              </ejb-relation>
    </relationships>
    <assembly-descriptor>
    <security-role>
    <role-name>Employees</role-name>
    </security-role>
    <method-permission>
    <role-name>Employees</role-name>
    <method>
    <ejb-name>CategoryEJB</ejb-name>
    <method-name>*</method-name>
    </method>
    </method-permission>
    <container-transaction>
    <method>
    <ejb-name>CategoryEJB</ejb-name>
    <method-name>*</method-name>
    </method>
    <method>
    <ejb-name>ProductEJB</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>     
    Here is my weblogic-cmp-rdbms-jar.xml:
    <!DOCTYPE weblogic-rdbms-jar PUBLIC
    '-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB RDBMS Persistence//EN'
    'http://www.bea.com/servers/wls810/dtd/weblogic-rdbms20-persistence-810.dtd'>
    <weblogic-rdbms-jar>
    <weblogic-rdbms-bean>
         <ejb-name>CategoryEJB</ejb-name>
    <data-source-name>ShoeStore</data-source-name>
         <table-map>
              <table-name>category</table-name>
              <field-map>
              <cmp-field>categoryId</cmp-field>
              <dbms-column>categoryID</dbms-column>
              </field-map>
              <field-map>
              <cmp-field>categoryName</cmp-field>
              <dbms-column>categoryName</dbms-column>
              </field-map>
              <field-map>
              <cmp-field>picture</cmp-field>
              <dbms-column>Picture</dbms-column>
              </field-map>
              <field-map>
              <cmp-field>pictureWidth</cmp-field>
              <dbms-column>PictureWidth</dbms-column>
              </field-map>
              <field-map>
              <cmp-field>pictureHeight</cmp-field>
              <dbms-column>PictureHeight</dbms-column>
              </field-map>
              <field-map>
              <cmp-field>labelOn</cmp-field>
              <dbms-column>LabelOn</dbms-column>
              </field-map>
              <field-map>
              <cmp-field>labelOff</cmp-field>
              <dbms-column>LabelOff</dbms-column>
              </field-map>
              <field-map>
              <cmp-field>button</cmp-field>
              <dbms-column>Button</dbms-column>
              </field-map>
    </table-map>
    <automatic-key-generation>
    <generator-type>SQL_SERVER</generator-type>
    </automatic-key-generation>
    </weblogic-rdbms-bean>
    <weblogic-rdbms-bean>
         <ejb-name>ProductEJB</ejb-name>
    <data-source-name>ShoeStore</data-source-name>
         <table-map>
              <table-name>PRODUCT</table-name>
              <field-map>
              <cmp-field>productId</cmp-field>
              <dbms-column>productId</dbms-column>
              </field-map>
              <field-map>
              <cmp-field>brandName</cmp-field>
              <dbms-column>brandName</dbms-column>
              </field-map>
              <field-map>
              <cmp-field>productDescription</cmp-field>
              <dbms-column>productDescription</dbms-column>
              </field-map>
              <field-map>
              <cmp-field>purchasePrice</cmp-field>
              <dbms-column>purchasePrice</dbms-column>
              </field-map>
              <field-map>
              <cmp-field>category</cmp-field>
              <dbms-column>categoryId</dbms-column>
              </field-map>
    </table-map>
         <!-- Automatically generate the value of ID in the database on inserts using sequence table -->
    <automatic-key-generation>
    <generator-type>SQL_SERVER</generator-type>
    </automatic-key-generation>
    </weblogic-rdbms-bean>
    <weblogic-rdbms-relation>
         <relation-name>Category-Product</relation-name>
    <weblogic-relationship-role>
    <relationship-role-name>Product-belongs-to-Category</relationship-role-name>
              <relationship-role-map>
    <column-map>
    <foreign-key-column>categoryId</foreign-key-column>
    <key-column>categoryID</key-column>
    </column-map>
              </relationship-role-map>
    </weblogic-relationship-role>
    </weblogic-rdbms-relation>
    </weblogic-rdbms-jar>
    Here is my productLocal.java:
    package com;
    import javax.ejb.CreateException;
    import javax.naming.NamingException;
    import java.util.Date;
    import java.util.Vector;
    import java.util.Collection;
    public interface ProductLocal extends javax.ejb.EJBLocalObject
         public Integer getProductId();
         public void setProductId(Integer productId);
         public String getBrandName();
         public void setBrandName(String brandName);
         public String getProductDescription();
         public void setProductDescription(String productDescription);
         public Double getPurchasePrice();
         public void setPurchasePrice(Double purchasePrice);
    public CategoryLocal getCategory();
         public void setCategory(CategoryLocal category);
    Here is my ProductBean.java:
    package com;
    import javax.naming.InitialContext;
    import javax.ejb.EntityContext;
    import javax.ejb.CreateException;
    import javax.naming.NamingException;
    import java.util.Date;
    import java.util.Collection;
    import java.util.Iterator;
    import java.util.Vector;
    import java.lang.Integer;
    public abstract class ProductBean implements javax.ejb.EntityBean
         public Integer ejbCreate(Integer id)
              this.setProductId(id);
              return null;
         public void ejbPostCreate(Integer id)
         //public abstract Integer getCategoryId();
    //     public abstract void setCategoryId(Integer categoryId);
         public abstract CategoryLocal getCategory();
         public abstract void setCategory(CategoryLocal category);
         public abstract Integer getProductId();
         public abstract void setProductId(Integer productId);
         public abstract String getBrandName();
         public abstract void setBrandName(String brandName);
         public abstract String getProductDescription();
         public abstract void setProductDescription(String productDescription);
         public abstract Double getPurchasePrice();
         public abstract void setPurchasePrice(Double purchasePrice);
         public void setEntityContext(EntityContext ec)
              System.out.println("ProductBean setEntityContext");
         public void unsetEntityContext()
              System.out.println("ProductBean unsetEntityContext");
         public void ejbLoad()
              System.out.println("ProductBean ejbLoad");
         public void ejbStore()
              System.out.println("ProductBean ejbStore");
         public void ejbActivate()
              System.out.println("ProductBean ejbActivate");
         public void ejbPassivate()
              System.out.println("ProductBean ejbPassivate");
         public void ejbRemove()
              System.out.println("ProductBean ejbRemove");
    What do I needed to do to fix this problem.
    Any hint or help would be greatly appreciated!!!
    Yours,
    Frustrated

    cmr field which is "category" in ur mapping , u can't use as cmp field in abstract schema mapping. just remove category from cmp field . and every thing is fine

Maybe you are looking for