Error While Deploying A CMP Entity Bean With A Composite Primary Key

Hello all,
I have a problem deploying CMP Entity beans with composite primary keys. I have a CMP Entity Bean, which contains a composite primary key composed of two local stubs. If you know more about this please respond to my post on the EJB forum (subject: CMP Bean Local Stub as a Field of a Primary Key Class).
In the mean time, can you please tell me what following error message means and how to resolve it? From what I understand it might be a problem with Sun ONE AS 7, but I would like to make sure it's not me doing something wrong.
[05/Jan/2005:12:49:03] WARNING ( 1896):      Validation error in bean CustomerSubscription: The type of non-static field customer of the key class
test.subscription.CustomerSubscriptionCMP_1530383317_JDOState$Oid must be primitive or must implement java.io.Serializable.
     Update the type of the key class field.
     Warning: All primary key columns in primary table CustomerSubscription of the bean corresponding to the generated class test.subscription.CustomerSubscriptionCMP_1530383317_JDOState must be mapped to key fields.
     Map the following primary key columns to key fields: CustomerSubscription.CustomerEmail,CustomerSubscription.SubscriptionType. If you already have fields mapped to these columns, verify that they are key fields.Is it enough that a primary key class be serializable or all fields have to implement Serializable or be a primitive?
Please let me know if you need more information to answer my question.
Thanks.
Nikola

Hi Nikola,
There are several problems with your CMP bean.
1. Fields of a Primary Key Class must be a subset of CMP fields, so yes, they must be either a primitive or a Serializable type.
2. Sun Application Server does not support Primary Key fields of an arbitrary Serializable type (i.e. those that will be stored
as BLOB in the database), but only primitives, Java wrappers, String, and Date/Time types.
Do you try to use stubs instead of relationships or for some other reason?
If it's the former - look at the CMR fields.
If it's the latter, I suggest to store these fields as regular CMP fields and use some other value as the PK. If you prefer that
the CMP container generates the PK values, use the Unknown
PrimaryKey feature.
Regards,
-marina

Similar Messages

  • Creating entity beans with auto numbered primary key

    I have two entity bean with a CMR between them. I am successfully creating the first one but when I try and create the child entity bean I get a NullPointerException.
    Now I think this is because the gernerated code tries to get the primary key of the created entity bean and this is not set as it is set using a auto number in the database (An oracle sequence and trigger).
    Is there anyway i can get round this problem?
    Thanks in advance,
    Adrian

    This is the auto generated code:
         public dmd.sync.ejbs.entity.AppliancePackInfoLocal create_Local(dmd.sync.dataobjects.dto.AppliancePackInfoDTO appliancePackInfoDTO, dmd.sync.ejbs.entity.AmppLocal amppLocal) throws javax.ejb.CreateException, java.rmi.RemoteException {
              BeanO beanO = null;
              dmd.sync.ejbs.entity.AppliancePackInfoLocal result = null;
              boolean createFailed = false;
              boolean preCreateFlag = false;
              try {
                   beanO = super.createBeanO();
                   dmd.sync.ejbs.entity.AppliancePackInfoBean bean = (dmd.sync.ejbs.entity.AppliancePackInfoBean) beanO.getEnterpriseBean();
                   preCreateFlag = super.preEjbCreate(beanO);
                   bean.ejbCreate(appliancePackInfoDTO, amppLocal);
                   Object ejsKey = keyFromBean(bean);
                   result = (dmd.sync.ejbs.entity.AppliancePackInfoLocal) super.postCreate_Local(beanO, ejsKey, true);
                   bean.ejbPostCreate(appliancePackInfoDTO, amppLocal);
                   super.afterPostCreate(beanO, ejsKey);
    It must be falling over on the last line as it calls the ejbPostCreate fine.

  • Error in weblogic.ejbc while deploying the CMP entity bean.!!!

    Tried to deploy the entity bean[CMP] with the following folder structure.
    examples [package]
    Product.class
    productBean.class
    etc.
    META-INF
    ejb-jar.xml
    weblogic-ejb-jar.xml.
    weblogic-cmp-rdbms-jar.xml
    created a jar..with the following command
    1.jar cvf rgegcmp.jar examples META-INF
    tried to create the stubs and skeletons using weblogic.ejbc command.
    2. java weblogic.ejbc rgegcmp.jar rgegcmp1.jar
    C:\btcomprj\BTCOMPRJ\classes>java weblogic.ejbc rgegcmp.jar rgegcmp1.jar
    <Oct 11, 2004 4:29:29 PM IST> <Warning> <EJB> <010054> <EJB Deployment: Product has a
    class examples.ProductBean which is in
    the classpath. This class should only be located in the ejb-jar file.>
    <Oct 11, 2004 4:29:29 PM IST> <Warning> <EJB> <010054> <EJB Deployment: Product has a
    class examples.ProductHome which is in
    the classpath. This class should only be located in the ejb-jar file.>
    <Oct 11, 2004 4:29:29 PM IST> <Warning> <EJB> <010054> <EJB Deployment: Product has a
    class examples.Product which is in the
    classpath. This class should only be located in the ejb-jar file.>
    <Oct 11, 2004 4:29:29 PM IST> <Warning> <EJB> <010054> <EJB Deployment: Product has a
    class examples.ProductLocalHome which i
    s in the classpath. This class should only be located in the ejb-jar file.>
    <Oct 11, 2004 4:29:29 PM IST> <Warning> <EJB> <010054> <EJB Deployment: Product has a
    class examples.ProductLocal which is in
    the classpath. This class should only be located in the ejb-jar file.>
    <Oct 11, 2004 4:29:29 PM IST> <Warning> <EJB> <010054> <EJB Deployment: Product has a
    class examples.ProductPK which is in th
    e classpath. This class should only be located in the ejb-jar file.>
    ERROR: Error from ejbc: null
    java.lang.NullPointerException
    at
    weblogic.ejb20.deployer.CompositeMBeanDescriptor.getPersistenceUseIdentifier(Composite
    MBeanDescriptor.java:1484)
    at weblogic.ejb20.deployer.CMPInfoImpl.<init>(CMPInfoImpl.java:104)
    at
    weblogic.ejb20.deployer.EntityBeanInfoImpl.<init>(EntityBeanInfoImpl.java:135)
    at
    weblogic.ejb20.deployer.BeanInfoImpl.createBeanInfoImpl(BeanInfoImpl.java:349)
    at
    weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.initializeBeanInfos(MBeanDeploymentInf
    oImpl.java:438)
    at
    weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.<init>(MBeanDeploymentInfoImpl.java:16
    5)
    at weblogic.ejb20.ejbc.EJBCompiler.setupEJB(EJBCompiler.java:151)
    at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:332)
    at weblogic.ejbc20.runBody(ejbc20.java:479)
    at weblogic.utils.compiler.Tool.run(Tool.java:126)
    at weblogic.ejbc.main(ejbc.java:29)
    ERROR: ejbc found errors
    1. want to know why Null pointer exception is thrown by 'weblogic.ejbc'...
    is it indicating an error in my code(bean); .....
    i dont know how to fix the error.
    find the deployments descriptors which i have written for deployment.
    weblogic-ejb-jar.xml
    <?xml version="1.0"?>
    <!DOCTYPE weblogic-ejb-jar PUBLIC
    '-//BEA Systems, Inc.//DTD WebLogic 7.0.0 EJB//EN'
    'http://www.bea.com/servers/wls700/dtd/weblogic-ejb-jar.dtd'>
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>Product</ejb-name>
    <jndi-name>rgexample</jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    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>Product</ejb-name>
    <home>examples.ProductHome</home>
    <remote>examples.Product</remote>
    <local-home>examples.ProductLocalHome</local-home>
    <local>examples.ProductLocal</local>
    <ejb-class>examples.ProductBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>examples.ProductPK</prim-key-class>
    <reentrant>False</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>ProductBean</abstract-schema-name>
    <cmp-field>
    <field-name>productID</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>name</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>description</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>basePrice</field-name>
    </cmp-field>
    <query>
    <query-method>
    <method-name>findByName</method-name>
    <method-params>
    <method-param>java.lang.String</method-param>
    </method-params>
    </query-method>
    <ejb-ql>
    <![CDATA[SELECT OBJECT(a) FROM ProductBean AS a WHERE name =
    ?1]]>
    </ejb-ql>
    </query>
    <query>
    <query-method>
    <method-name>findByDescription</method-name>
    <method-params>
    <method-param>java.lang.String</method-param>
    </method-params>
    </query-method>
    <ejb-ql>
    <![CDATA[SELECT OBJECT(a) FROM ProductBean AS a WHERE description
    = ?1]]>
    </ejb-ql>
    </query>
    <query>
    <query-method>
    <method-name>findByBasePrice</method-name>
    <method-params>
    <method-param>double</method-param>
    </method-params>
    </query-method>
    <ejb-ql>
    <![CDATA[SELECT OBJECT(a) FROM ProductBean AS a WHERE basePrice =
    ?1]]>
    </ejb-ql>
    </query>
    <query>
    <query-method>
    <method-name>findExpensiveProducts</method-name>
    <method-params>
    <method-param>double</method-param>
    </method-params>
    </query-method>
    <ejb-ql>
    <![CDATA[SELECT OBJECT(a) FROM ProductBean AS a WHERE basePrice >
    ?1]]>
    </ejb-ql>
    </query>
    <query>
    <query-method>
    <method-name>findCheapProducts</method-name>
    <method-params>
    <method-param>double</method-param>
    </method-params>
    </query-method>
    <ejb-ql>
    <![CDATA[SELECT OBJECT(a) FROM ProductBean AS a WHERE basePrice < ?1]]>
    </ejb-ql>
    </query>
    <query>
    <query-method>
    <method-name>findAllProducts</method-name>
    <method-params>
    </method-params>
    </query-method>
    <ejb-ql>
    <![CDATA[SELECT OBJECT(a) FROM ProductBean AS a WHERE productID
    IS NOT NULL]]>
    </ejb-ql>
    </query>
    </entity>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>Product</ejb-name>
    <method-intf>Remote</method-intf>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    weblogic-cmp-rdbms-jar.xml
    <!DOCTYPE weblogic-rdbms-jar PUBLIC
    '-//BEA Systems, Inc.//DTD WebLogic 7.0.0 EJB RDBMS Persistence//EN'
    'http://www.bea.com/servers/wls700/dtd/weblogic-rdbms20-persistence-700.dtd'>
    <weblogic-rdbms-jar>
    <weblogic-rdbms-bean>
    <ejb-name>Product</ejb-name>
    <data-source-name>examples-dataSource-demoPool</data-source-name>
    <table-map>
    <table-name>TORDER</table-name>
    <field-map>
    <cmp-field>productID</cmp-field>
    <dbms-column>PRODUCTID</dbms-column>
    </field-map>
    <field-map>
    <cmp-field>name</cmp-field>
    <dbms-column>NAME</dbms-column>
    </field-map>
    <field-map>
    <cmp-field>description</cmp-field>
    <dbms-column>DESCRIPTION</dbms-column>
    </field-map>
    <field-map>
    <cmp-field>basePrice</cmp-field>
    <dbms-column>BASEPRICE</dbms-column>
    </field-map>
    </table-map>
    </weblogic-rdbms-bean>
    <create-default-dbms-tables>True</create-default-dbms-tables>
    </weblogic-rdbms-jar>

    If you can have a look at a cmp example in the samples that ship with the server. My guess is that the weblogic-ejb-jar.xml file is missing the <persistence-use> element which for 810 would look like:
    <persistence>
    <persistence-use>
    <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
    <type-version>7.0</type-version>
    <type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
    </persistence-use>
    </persistence>
    I seem to recall that the elements might be slightly different in structure for the wls700 version of the DTD, so please check that (I cannot, I'm at home and don't have everything here).
    Give that a try and see if it doesn't solve your compilation failure.
    Also, the compilation should not be throwing a null pointer exception in a case like that, I consider that to be a bug.
    -thorick

  • Bad Performance/OutOfMemory Error in CMP Entity Bean with Large DB

    Hello:
    I have an CMP Entity deployed on WLS 7.0
    The entity bean maps to a table that has 97,480 records.
    It has a finder: findAll() -- SELECT OBJECT(e) FROM Equipment e
    I have a JSP client that invokes the findALL()
    The performance is very poor ~ 150 seconds just to perform the findAll() - (Benchmark
    from within the JSP code)
    If more than one simultaneous call is made then I get outOfMemory Error.
    WLS is started with max memory of 512MB
    EJB is deployed with <max-beans-in-cache>100000</max-beans-in-cache>
    (without max-beans-in-cache directive the performance is worse)
    Is there any documentation available to help us in deploying CMP Entity Beans
    with very large number of records (instances) ?
    Any help is greatly appreciated.
    Regards
    Rajan

    Hi
    You should use a Select Method, it does support cursors.
    Or a Home Select Method combination.
    Regards
    Thomas
    WLS is started with max memory of 512MB
    EJB is deployed with <max-beans-in-cache>100000</max-beans-in-cache>>
    (without max-beans-in-cache directive the performance is worse)>
    Is there any documentation available to help us in deploying CMP
    Entity Beans with very large number of records (instances) ? Any help
    is greatly appreciated.>
    Regards>
    Rajan>
    >
    "Rajan Jena" <[email protected]> schrieb im Newsbeitrag
    news:3dadd7d1$[email protected]..
    >
    Hello:
    I have an CMP Entity deployed on WLS 7.0
    The entity bean maps to a table that has 97,480 records.
    It has a finder: findAll() -- SELECT OBJECT(e) FROM Equipment e
    I have a JSP client that invokes the findALL()
    The performance is very poor ~ 150 seconds just to perform the findAll() -(Benchmark
    from within the JSP code)
    If more than one simultaneous call is made then I get outOfMemory Error.
    WLS is started with max memory of 512MB
    EJB is deployed with <max-beans-in-cache>100000</max-beans-in-cache>
    (without max-beans-in-cache directive the performance is worse)
    Is there any documentation available to help us in deploying CMP EntityBeans
    with very large number of records (instances) ?
    Any help is greatly appreciated.
    Regards
    Rajan

  • CMP Entity Bean with ejb-ql finder methods and INFORMIX database

    Hi,
    I have some CMP Entity Beans with finder methods defined in ejb-ql. In my ejb-jar, within <entity> definitions I have something like:
        <entity>
          <abstract-schema-name>BeanName</abstract-schema-name>
          <cmp-field><field-name>fieldOne</field-name></cmp-field>
          <cmp-field><field-name>fieldTwo</field-name></cmp-field>
          <query>
            <query-method>
              <method-name>findAll</method-name>
              <method-params></method-params>
            </query-method>
            <ejb-ql>SELECT OBJECT(o) FROM BeanName o</ejb-ql>
          </query>
        <entity>
    And in persistent.xml:
    <db-properties>
         <data-source-name>datasource_name</data-source-name>
    </db-properties>
    <entity-bean>
         <ejb-name>BeanName</ejb-name>
         <table-name>table_name</table-name>
         <field-map key-type="NoKey">
         <field-name>fieldOne</field-name>
         <column><column-name>column_one</column-name></column>
          </field-map>
         <field-map key-type="NoKey">
         <field-name>fieldTwo</field-name>
         <column><column-name>column_two</column-name></column>
          </field-map>
          <finder-descriptor>
              <method-name>findAll</method-name>
              <method-params/>
         </finder-descriptor>
    Once deployed, on server side, I can found a java source file (with corresponding compiled class file) in path:
    j2ee/cluster/server0/apps/companyName/MyEARApp/EJBContainer/temp/temp38837373733/route/to/package/
    with names:
    BeanName0_0pm.java
    BeanName0_0PM.class
    and the generated java file contains this code:
      public java.util.Enumeration ejbFindAll() throws javax.ejb.FinderException, javax.ejb.EJBException  {
        TransactionContext tc = pm.getTransactionContext();
        Connection conn = null;
        PreparedStatement pSt = null;
        ResultSet ejb_rs = null;
        int status = javax.transaction.xa.XAResource.TMSUCCESS;
        try {
          conn = pm.getConnectionForFindMethod();
          pSt = conn.prepareStatement("SELECT \"O\".\"COLUMN_ONE\",\"O\".\"COLUMN_TWO\", FROM \"TABLE_NAME\" \"O\"");
          ejb_rs = pSt.executeQuery();
    I'm trying to call this method but it throws a SQLException when preparing the statement.
    It seems that Informix does not like this SQL syntax because of upper case names, doble quotes on table alias, or something else.
    When editing persistent.xml in netweaver, I can define the element <datasource-vendor> as ORACLE, SAPDB, MS_SQL_SERVER, DB2_UDB_AS400 or DB2_UDB_OS390 but INFORMIX is not an accepted value.
    Is there any way to define how this SQL query is build?
    Thanks in advance.

    The return type of the finder method defined in the remote home interface is either the entity bean's remote interface or a collection of objects implementing the entity bean's remote interface. The return type of the finder method defined in the local home interface is either the entity bean's local interface or a collection of objects implementing the entity bean's local interface

  • Error when deploying a simple Entity bean (EJB3) on Glassfich or Sun AS

    Hi,
    After some problems when deploying complex EJB3 Entity bean on GlassFich with a MySQL connector, I have made a simple entity.
    (test with Glassfish and Sun AS with same result)
    With netbean 5.5 => New EJB Module
    File->New->Persistence Unit (and use default values)
    Persistence.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
      <persistence-unit name="test" transaction-type="JTA">
       <provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
        <jta-data-source>jdbc/sample</jta-data-source>
        <properties>
          <property name="toplink.ddl-generation" value="create-tables"/>
        </properties>
      </persistence-unit>
    </persistence>File->New->Entity Class
    EntityTest.java
    package test;
    import java.io.Serializable;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    @Entity
    public class EntityTest implements Serializable
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        private Long id;
        /** Creates a new instance of EntityTest */
        public EntityTest()
        public Long getId()
            return id;
        public void setId(Long id)
            this.id = id;
        public String toString()
            //TODO change toString() implementation to return a better display name
            return "" + this.id;
    }Build of project work fine but when I try to deploy (with the 2 servers), I have the error :
    Exception occured in J2EEC Phase
    com.sun.enterprise.deployment.backend.IASDeploymentException: Deployment Error -- null
    at java.util.HashMap$HashIterator.nextEntry(HashMap.java:790)
    at java.util.HashMap$KeyIterator.next(HashMap.java:823)
    at com.sun.enterprise.deployment.backend.EjbModuleDeployer.generatePolicy(EjbModuleDeployer.java:203)
    at com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(ModuleDeployer.java:171)
    at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:169)
    at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:266)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:739)
    at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:174)
    at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:210)

    Yes, the problem is that the ejb-jar must contain at least one ejb component. It's a common misconception that Java Persistence API Entity classes are ejb components but they are NOT. The Java Persistence API was developed within the EJB 3.0 JSR and works very well with EJB but the entity classes themselves are not full-fledged ejb components.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • ORA-01407 when removing a CMP Entity Bean with WLS 9.1

    Hi all !
    I hope you can help me to solve this ?:|
    I'm migrating my application from WLS 8.1 SP3 to WLS 9.1.
    I'm getting now an SQLException when I try to remove a CMP Entity Bean.
    The stacktrace is as follows:
    java.sql.SQLException: ORA-01407: cannot update ("USER"."MY_TABLE"."THE_CMR_FIELD") to NULL
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
         at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1120)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1278)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3415)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3498)
         at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:128)
    Of course, I replaced the table and column names above to be more readable ;-)
    The table MY_TABLE has a CMR field called THE_CMR_FIELD. The column is not nullable in the database (by the way, it's an Oracle 9i).
    Everything is fine under WLS8.1
    I tried two different Oracle JDBC drivers (9.2.0.5 and 10.2.0.1.0), but the result is always the same within WLS9.1.
    Any ideas or suggestions (or even questions) are more than welcome!
    Thanks
    Eric

    What's even more weird is that I have what seams to be the same problem on Weblogic 6.1 (SP4).
    Here's the stacktrace:
    <pre>
    javax.ejb.EJBException:
    Start server side stack trace:
    java.sql.SQLException: ORA-01407: cannot update ("SCHEMA"."TIM_WP_DAY_CORE_PERIODS"."TWD_ID") to NULL
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
         at com.p6spy.engine.logging.P6LogPreparedStatement.executeUpdate(P6LogPreparedStatement.java:183)
         at weblogic.jdbc.jts.Statement.executeUpdate(Statement.java:503)
         at package.WorkPatternDayCorePeriods_vd9y46__WebLogic_CMP_RDBMS.__WL_store(WorkPatternDayCorePeriods_vd9y46__WebLogic_CMP_RDBMS.java:2317)
         at weblogic.ejb20.manager.DBManager.flushModified(DBManager.java:438)
         at weblogic.ejb20.internal.TxManager$TxListener.flushModifiedKeys(TxManager.java:552)
         at weblogic.ejb20.internal.TxManager.flushModifiedBeans(TxManager.java:298)
         at weblogic.ejb20.manager.BaseEntityManager.flushModifiedBeans(BaseEntityManager.java:1246)
         at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.flushModifiedBeans(RDBMSPersistenceManager.java:1106)
         at weblogic.ejb20.manager.BaseEntityManager.cascadeDeleteRemove(BaseEntityManager.java:840)
         at weblogic.ejb20.manager.DBManager.remove(DBManager.java:656)
         at weblogic.ejb20.internal.EntityEJBLocalObject.remove(EntityEJBLocalObject.java:97)
         at package.WorkPatternDayCorePeriodsEJB_vd9y46_ELOImpl.remove(WorkPatternDayCorePeriodsEJB_vd9y46_ELOImpl.java:722)
         at package.PersonWorkPatternBC.removeWorkPatternDay(PersonWorkPatternBC.java:571)
         at package.remove(PersonWorkPatternBC.java:708)
         at package.TimPersonCalendarServiceEJB.removeWorkPattern(TimPersonCalendarServiceEJB.java:140)
    </pre>
    In fact I have this setup:
    <pre>
    workpattern 1..n workpatternday -| 1..n dayperiod
    | 1..n daycoreperiod
    </pre>
    And before 'ejbRemove'ing the workpattern I first remove the days and before that the periods and core periods.
    I start with the periods and instead of removing them in the DB he tries to update the FK to the day with '' (p6spy result).
    When I remove the not null constraint on the foreign key everything passes to the day where the workpatternId cannot be set to null.
    He does not throw errors on the coreperiod (where the not null constraint to day is still present).
    When I invert the sequence of deleting
    (first the core periods then the 'regular' periods) he complains about the dayId on the core periods table.
    So it's completely absurd :S
    I hope weblogic 8.1 might solve this problem as this development code is still to be migrated to 8.1 before going in production...
    I would just like to know what's wrong. There are other places with just about the same relationships (CMR and DB) where he does not complain...

  • CMP entity bean with compound primary key

    I'm trying to use a compound primary key in a CMP entity bean. I've created the custom primary key class okay, and I have the prim-key-class set in ejb-jar.xml. My client app gets the home reference okay, but when it tries to find an entity, I get the exception "SQLException: Incorrect syntax near '/'."
    I think I'm having trouble deploying this in OC4J. Is there a sample orion-ejb-jar.xml deployment for a custom, compound primary key somewhere?
    Many thanks for any help.
    Ernie

    Never mind. I solved my problem. Thanks.

  • Caching CMP Entity Beans with 9.0.2

    Hi,
    my CMP Entity Bean is accessed from a JSP-Page through a Stateless Session Bean. The Session-Bean executes findAll() on the Entity-Bean and the JSP-Page iterates over the Collection and displays the Fields through their getter-Methods. It turns out that every getXXX Methods results in a complete load of the Bean from the Database, so for 3 database-records with 4 attributes i get 12 SELECT - statements and 12 Activate/Load/Passivate cycles of the Entity Bean!!!!
    I tried to setup the attributes in orion-ejb-jar.xml correctly, but that didn't show a difference:
    -) exclusive-write-access="true" does only work in "read-only" mode (see oc4j_ejb_guide_r2.pdf)
    -) setting timeouts didnt work
    My Entity Bean settings are:
    exclusive-write-access="true"
    instance-cache-timeout="60"
    max-instances="100"
    max-tx-retries="0"
    pool-cache-timeout="100"
    The EJB-Callbacks are:
    first the Session-Bean is created, and findAll() is executed - then all Entity-Beans are passivated again:
    TestManBean Constructor called 1
    TestManBean.setSessionContext() 1
    TestManBean.ejbCreate() 1
    PersonBean Constructor called 1
    PersonBean.setEntityContext() 1
    PersonBean.ejbActivate() 1
    PersonBean.ejbLoad() 1
    PersonBean Constructor called 2
    PersonBean.setEntityContext() 2
    PersonBean.ejbActivate() 2
    PersonBean.ejbLoad() 2
    PersonBean Constructor called 3
    PersonBean.setEntityContext() 3
    PersonBean.ejbActivate() 3
    PersonBean.ejbLoad() 3
    PersonBean.ejbPassivate() 1
    PersonBean.ejbPassivate() 2
    PersonBean.ejbPassivate() 3
    now for every getXXX-Methods the following occurs:
    PersonBean.ejbActivate() 3
    PersonBean.ejbLoad() 3
    PersonBean.ejbPassivate() 3
    I user OC4J 9.0.2 Production with Oracle 8.1.6.
    How can I turn on Entity-Bean Caching?
    Thanks,
    Gilbert

    Hi Gilbert,
    Someone recently asked a similar question to yours. Perhaps that thread will
    be helpful to you?
    Author: Valeri Kireitchik
    Subject: how to set exclusive-write-access="true"
    Date: May 17, 2002 10:18 PT
    URL:
    Re: Get the Table name by providing the Sequence name
    The same person (Valeri) also asked his question on two other forums:
    http://www.elephantwalker.com/rfa?id=549
    http://www.mail-archive.com/orion-interest%40orionserver.com/msg19037.html
    Good Luck,
    Avi.

  • CMP Entity Bean With Primary Key of int

    Is it valid to have a CMP Entity Bean (v1.1) where the primary key is defined as the primitive 'int' instead of a true Java class?
    Thanks in advance,
    Marc

    Hi,
    Ur primary key in the EJB cant be a primitive data type. If the primary key in the table is a int,
    then u will hv [bold] java.lang.Integer [bold] as the datatype in Entity Bean. If u hv further queries write me at [email protected]
    Kesavan.

  • Creation of CMP bean for a Composite Primary key????

    Hi
    i am having a composite primary keys in one of my table in the database.
    I am trying to create a new entity bean for this table but i don't know how to create one in case when there is a composite primary key for a table.
    Can anybody let me know is it possible to do it.
    what is the procedure to be followed for the creation of the Entity bean in case of a composite primary key.
    I am using MySql as the database .Creating CMP type of Entity bean.
    Any help in this regard will be greatly useful to me as this is very urgent.
    Thanks & Regards
    Vikram K

    Hi Nikola,
    There are several problems with your CMP bean.
    1. Fields of a Primary Key Class must be a subset of CMP fields, so yes, they must be either a primitive or a Serializable type.
    2. Sun Application Server does not support Primary Key fields of an arbitrary Serializable type (i.e. those that will be stored
    as BLOB in the database), but only primitives, Java wrappers, String, and Date/Time types.
    Do you try to use stubs instead of relationships or for some other reason?
    If it's the former - look at the CMR fields.
    If it's the latter, I suggest to store these fields as regular CMP fields and use some other value as the PK. If you prefer that
    the CMP container generates the PK values, use the Unknown
    PrimaryKey feature.
    Regards,
    -marina

  • Master Detail Forms with 2 composite primary keys - Is there a workaround?

    Hello All,
    I have been searching for a workaround to the maximum 2 part primary key restriction on the multi-row updates, and master-detail forms, and am hoping that someone can help me. I am using HTMLDB v2.0.0.00.49 with IE 6 against a 9.2 DB.
    I successfully implemented the workaround of Fred Stoopendaal's (see Updata PK on HTML DB ) and it works fine for single page multi-record updateable forms, but alas I haven't been able to extend it to master detail forms (I think it is something to do with Oracle not allowing the "returning" clause on views).
    Here is what I tried:
    two tables, one with a 2 part composite primary key, which is the master table, and a detail table with 3 part composite primary key -
    --------- BEGIN SQL ---------
    create table master_table
    ( master_col1 number
    , master_col2 number
    , master_col3 varchar2(30)
    , constraint master_pk primary key (master_col1,master_col2));
    create table detail_table
    (detail_col1 number
    ,detail_col2 number
    ,detail_col3 number
    ,detail_col4 varchar2(30)
    , constraint detail_pk primary key(detail_col1,detail_col2,detail_col3)
    , constraint master_detail_fk foreign key (detail_col1,detail_col2) references master_table(master_col1,master_col2));
    create or replace view v_master_table as
    select rowid mata_rowid,mata.*
    from master_table mata;
    create or replace view v_detail_table as
    select rowid deta_rowid,
    (select rowid from master_table mata where mata.master_col1 = deta.detail_col1 and mata.master_col2 = deta.detail_col2) deta_mata_rowid
    , deta.*
    from detail_table deta;
    create or replace trigger mata_ins_upd_trg
    instead of insert or update on v_master_table
    referencing new as new old as old
    for each row
    begin
    if inserting then
    insert into master_table (master_col1, master_col2, master_col3)
    values (:new.master_col1, :new.master_col2, :new.master_col3);
    end if;
    if updating then
    update master_table
    set master_col1 = :new.master_col1,
    master_col2 = :new.master_col2,
    master_col3 = :new.master_col3
    where rowid = :old.mata_rowid;
    end if;
    end;
    create or replace trigger deta_ins_upd_trg
    instead of insert or update on v_detail_table
    referencing new as new old as old
    for each row
    begin
    if inserting then
    insert into detail_table ( detail_col1, detail_col2, detail_col3, detail_col4)
    values (:new.detail_col1, :new.detail_col2, :new.detail_col3, :new.detail_col4);
    end if;
    if updating then
    update detail_table
    set detail_col1 = :new.detail_col1,
    detail_col2 = :new.detail_col2,
    detail_col3 = :new.detail_col3,
    detail_col4 = :new.detail_col4
    where rowid = :old.deta_rowid;
    end if;
    end;
    --------- END SQL ---------
    Then I created a master-detail form in Apex on the two views, using the mata_rowid and deta_rowid as primary keys, and mata_rowid=deta_mata_rowid as the link. I realise that using a function to fetch the master rowid within the detail view query is costly, but it was my intention to modify the record fetch queries to use the real FK columns once things were up and running.
    It seems to generate the pages ok, and I can insert/update master table records, but as soon as I modify records in the detail table things go a bit haywire. I can't find any documentation on how the inbuilt MRU/MRD logic works, so can't figure out the issue.
    Can anyone out there tell me what the problem is with the logic above, or if they have come up with a neat solution to this annoying limitation. I know that many will say that I should modify the data model to use surrogate primary keys, but many of the uses for HTMLDB are new interfaces for old schemas, so a workaround that doesn't involve wholesale data model changes would be preferable.
    Thanks in advance,
    Mike Cretan

    Hi, this is likely not the most elegant way...but perhaps the simplest -- and I didn't have much time to play.
    I used Wizard to create two separate Master Detail forms, each with a separate detail table. Thus I ended up with four pages:
    Page "A" - "Selector" page for Master (Report), with Edit link driving to Detail-1
    Page "B" - Editable Master/Detail-1 page (HTML / Report)
    Page "C" - "Selector" page for Master (Report), with Edit link driving to Detail-2
    Page "D" - Editable Master/Detail-2 page (HTML / Report)
    Then I selected the primary key column TWICE on the Report on Page A. Modified the second instance of this column to navigate to Page D (passing primary key) exactly the way the original instance of this column navigates to Page B. Then I deleted Page C.
    Since you can have only one Tabular Entry form per page, this seemed the best way to drive two separate detail tables from a common interface.

  • Error while deployment of  CMP 2.0 bean on weblogic 11g

    Hi,
    I am not able to deploy my CMP 2.0 bean on Weblogic 11g. There are two JVM available in weblogic 11g.
    1) Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
    2) Oracle JRockit(R) (build R28.1.1-14-139783-1.6.0_22-20101206-0241-windows-ia32, compiled mode)
    When we are using "Oracle JRockit(R) (build R28.1.1-14-139783-1.6.0_22-20101206-0241-windows-ia32, compiled mode)" And deploying the CMP bean then we got the Error as below:
    D:\Oracle\Middleware\wlserver_10.3\server\bin>java weblogic.appc -verbose C:\temp\Jproject.ear\DefinitionWizardBean.jar
    Created working directory: C:\DOCUME~1\cxp\LOCALS~1\Temp\1\appcgen_1309496813354_DefinitionWizardBean.jar
    <01-Jul-2011 06:06:57 o'clock BST> <Warning> <Munger> <BEA-2156203> <A version attribute was not found in element persis
    tence in the deployment descriptor in C:\temp\Jproject.ear\DefinitionWizardBean.jar/META-INF/weblogic-ejb-jar.xml. A vers
    ion attribute is required, but this version of the Weblogic Server will assume that the JEE5 is used. Future versions of
    the Weblogic Server will reject descriptors that do not specify the JEE version.>
    java.lang.NoClassDefFoundError: EntityBean
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:343)
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:302)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
    at weblogic.ejb.container.deployer.BeanInfoImpl.loadClass(BeanInfoImpl.java:510)
    at weblogic.ejb.container.deployer.BeanInfoImpl.<init>(BeanInfoImpl.java:242)
    at weblogic.ejb.container.deployer.ClientDrivenBeanInfoImpl.<init>(ClientDrivenBeanInfoImpl.java:156)
    at weblogic.ejb.container.deployer.EntityBeanInfoImpl.<init>(EntityBeanInfoImpl.java:115)
    at weblogic.ejb.container.deployer.BeanInfoImpl.createBeanInfoImpl(BeanInfoImpl.java:695)
    at weblogic.ejb.container.deployer.MBeanDeploymentInfoImpl.initializeBeanInfos(MBeanDeploymentInfoImpl.java:558)
    at weblogic.ejb.container.deployer.MBeanDeploymentInfoImpl.<init>(MBeanDeploymentInfoImpl.java:236)
    at weblogic.ejb.container.ejbc.EJBCompiler.getStandAloneDeploymentInfo(EJBCompiler.java:1185)
    at weblogic.ejb.container.ejbc.EJBCompiler.setupEJB(EJBCompiler.java:156)
    at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:439)
    at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:396)
    at weblogic.application.compiler.AppcUtils.compileEJB(AppcUtils.java:316)
    at weblogic.application.compiler.EJBModule.compile(EJBModule.java:128)
    at weblogic.application.compiler.flow.SingleModuleCompileFlow.proecessModule(SingleModuleCompileFlow.java:18)
    at weblogic.application.compiler.flow.SingleModuleFlow.compile(SingleModuleFlow.java:36)
    at weblogic.application.compiler.FlowDriver$FlowStateChange.next(FlowDriver.java:69)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.compiler.FlowDriver.nextState(FlowDriver.java:36)
    at weblogic.application.compiler.FlowDriver.run(FlowDriver.java:26)
    at weblogic.application.compiler.EJBCompiler.compile(EJBCompiler.java:29)
    at weblogic.application.compiler.flow.AppCompilerFlow.compileInput(AppCompilerFlow.java:112)
    at weblogic.application.compiler.flow.AppCompilerFlow.compile(AppCompilerFlow.java:37)
    at weblogic.application.compiler.FlowDriver$FlowStateChange.next(FlowDriver.java:69)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.compiler.FlowDriver.nextState(FlowDriver.java:36)
    at weblogic.application.compiler.FlowDriver.run(FlowDriver.java:26)
    at weblogic.application.compiler.Appc.runBody(Appc.java:203)
    at weblogic.utils.compiler.Tool.run(Tool.java:158)
    at weblogic.utils.compiler.Tool.run(Tool.java:115)
    at weblogic.application.compiler.Appc.main(Appc.java:262)
    at weblogic.appc.main(appc.java:14)
    EntityBean
    But I use JVM " Java(TM) SE Runtime Environment (build 1.6.0_22-b04) " and deploying CMP bean then i got error as below:
    D:\Oracle\Middleware\wlserver_10.3\server\bin>d:\Oracle\Middleware\jdk160_21\bin\java weblogic.appc -verbose C:\temp\Tr
    ading.ear\DefinitionWizardBean.jar
    Created working directory: C:\DOCUME~1\cxp\LOCALS~1\Temp\1\appcgen_1309496852057_DefinitionWizardBean.jar
    <01-Jul-2011 06:07:35 o'clock BST> <Warning> <Munger> <BEA-2156203> <A version attribute was not found in element persis
    tence in the deployment descriptor in C:\temp\Jproject.ear\DefinitionWizardBean.jar/META-INF/weblogic-ejb-jar.xml. A vers
    ion attribute is required, but this version of the Weblogic Server will assume that the JEE5 is used. Future versions of
    the Weblogic Server will reject descriptors that do not specify the JEE version.>
    java.lang.ClassNotFoundException: EntityBean
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:343)
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:302)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
    at weblogic.ejb.container.deployer.BeanInfoImpl.loadClass(BeanInfoImpl.java:510)
    at weblogic.ejb.container.deployer.BeanInfoImpl.<init>(BeanInfoImpl.java:242)
    at weblogic.ejb.container.deployer.ClientDrivenBeanInfoImpl.<init>(ClientDrivenBeanInfoImpl.java:156)
    at weblogic.ejb.container.deployer.EntityBeanInfoImpl.<init>(EntityBeanInfoImpl.java:115)
    at weblogic.ejb.container.deployer.BeanInfoImpl.createBeanInfoImpl(BeanInfoImpl.java:695)
    at weblogic.ejb.container.deployer.MBeanDeploymentInfoImpl.initializeBeanInfos(MBeanDeploymentInfoImpl.java:558)
    at weblogic.ejb.container.deployer.MBeanDeploymentInfoImpl.<init>(MBeanDeploymentInfoImpl.java:236)
    at weblogic.ejb.container.ejbc.EJBCompiler.getStandAloneDeploymentInfo(EJBCompiler.java:1185)
    at weblogic.ejb.container.ejbc.EJBCompiler.setupEJB(EJBCompiler.java:156)
    at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:439)
    at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:396)
    at weblogic.application.compiler.AppcUtils.compileEJB(AppcUtils.java:316)
    at weblogic.application.compiler.EJBModule.compile(EJBModule.java:128)
    at weblogic.application.compiler.flow.SingleModuleCompileFlow.proecessModule(SingleModuleCompileFlow.java:18)
    at weblogic.application.compiler.flow.SingleModuleFlow.compile(SingleModuleFlow.java:36)
    at weblogic.application.compiler.FlowDriver$FlowStateChange.next(FlowDriver.java:69)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.compiler.FlowDriver.nextState(FlowDriver.java:36)
    at weblogic.application.compiler.FlowDriver.run(FlowDriver.java:26)
    at weblogic.application.compiler.EJBCompiler.compile(EJBCompiler.java:29)
    at weblogic.application.compiler.flow.AppCompilerFlow.compileInput(AppCompilerFlow.java:112)
    at weblogic.application.compiler.flow.AppCompilerFlow.compile(AppCompilerFlow.java:37)
    at weblogic.application.compiler.FlowDriver$FlowStateChange.next(FlowDriver.java:69)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.compiler.FlowDriver.nextState(FlowDriver.java:36)
    at weblogic.application.compiler.FlowDriver.run(FlowDriver.java:26)
    at weblogic.application.compiler.Appc.runBody(Appc.java:203)
    at weblogic.utils.compiler.Tool.run(Tool.java:158)
    at weblogic.utils.compiler.Tool.run(Tool.java:115)
    at weblogic.application.compiler.Appc.main(Appc.java:262)
    at weblogic.appc.main(appc.java:14)
    EntityBean
    Please assist me regarding above error
    Thanks,
    Amritesh
    Edited by: 869636 on 01-Jul-2011 00:49

    What is the jee version you have on that server? are the environment variables correctly set?

  • Error when deploying an CMP-Entity EJB

    Hi ,
    I am unable to deploy a simple example of CMP ,when i select Entity,then select Deployment Settings->Generate Default SQL,
    My SQL Query is:'SELECT OBJECT(p) FROM Product p' for FfindAllProducts().
    I get the error message:
    ERROR:while generating SQL.
    The SELECT clause has a return type that does not match the return type
    of the select query for which it is defined
    EJB QL statement: 'SELECT OBJECT(p)fROM Product p'
    EJB QL method:public abstract java.util.Collection com.aa.ProductHome.findAllProducts() throws javax.ejb.FinderException,java.rmi.RemoteException.
    Followinng are the codes of My bean
    ProductHome.java
    import javax.ejb.*;
    import java.rmi.RemoteException;
    import java.util.Collection;
    public interface ProductHome extends EJBHome
    Product create(String productId,String name , String description , double basePrice) throws CreateException,RemoteException;
    public Product findByPrimaryKey(ProductPK key) throws FinderException,RemoteException;
    public Collection findByName(String name) throws FinderException,RemoteException;
    public Collection findByDescription(String description) throws FinderException,RemoteException;
    public Collection findAllProducts() throws FinderException,RemoteException;
    ProductBean.java
    import javax.ejb.*;
    import java.rmi.RemoteException;
    public class ProductBean implements EntityBean
    protected EntityContext ctx;
    public String productid;
    public String name;
    public String description;
    public ProductBean()
    public String getName() throws RemoteException
    return this.name;
    public void setName(String name) throws RemoteException
    this.name=name;
    public String getDescription() throws RemoteException
    return this.description;
    public void setDescription(String description) throws RemoteException
    this.description=description;
    public String getProductId() throws RemoteException
    return this.productid;
    public void setProductId(String ProductId) throws RemoteException
    this.productid=ProductId;
    public void ejbActivate()
    public void ejbPassivate()
    public void ejbRemove()
    public void ejbLoad()
    public void ejbStore()
    public void setEntityContext(EntityContext ctx)
    this.ctx = ctx;
    public void unsetEntityContext()
    this.ctx = null;
    public void ejbPostCreate(String productId,String name,String description,double baseprice)
    public ProductPK ejbCreate(String productId,String name,String description,double baseprice) throws CreateException,RemoteException
    called ");
    setName(name);
    setProductId(productId);
    setDescription(description);
    return null;
    Product.java
    import javax.ejb.*;
    import java.rmi.RemoteException;
    public interface Product extends EJBObject
    public String getName() throws RemoteException;
    public void setName(String name) throws RemoteException;
    public String getDescription() throws RemoteException;
    public void setDescription(String description) throws RemoteException;
    public String getProductId() throws RemoteException;
    public void setProductId(String productid) throws RemoteException;
    ProductClient.java
    import java.rmi.*;
    import javax.rmi.*;
    import javax.naming.*;
    import javax.ejb.*;
    import java.util.*;
    public class ProductClient
    public static void main(String ars[])
    ProductHome home=null;
    try
    Context initial = new InitialContext();
    Context myEnv = (Context)initial.lookup("java:comp/env");
    Object objref = myEnv.lookup("ejb/TheProduct");
    home = (ProductHome)PortableRemoteObject.narrow(objref,ProductHome.class);
    home.create("123-446-7890","p5-350","350 Mhz Pentium",200 );
    home.create("123-446-7891","p5-400","400 Mhz Pentium",300 );
    home.create("123-446-7892","p5-450","450 Mhz Pentium",400 );
    home.create("123-446-7893","p5-500","500 Mhz Pentium",500 );
    home.create("123-446-7894","p5-550","550 Mhz Pentium",600 );
    Iterator i = home.findByName("p5-400").iterator();
    System.out.println(" Product Match the name of p5-400 " );
    if ( i.hasNext() )
    Product prod = (Product)PortableRemoteObject.narrow(i.next(),Product.class);
    System.out.println(prod.getDescription());
    else
    throw new Exception(" Could not find Product ");
    catch(Exception e)
    System.out.println("Caught Exception " );
    e.printStackTrace();
    finally
    if ( home != null)
    System.out.println(" Destroying all products " );
    try
    Iterator i = home.findAllProducts().iterator();
    while ( i.hasNext() )
    Product prod = (Product)PortableRemoteObject.narrow(i.next(),Product.class);
    if (prod.getProductId().startsWith("123"))
    prod.remove();
    catch (Exception e)
    e.printStackTrace();
    ProductPk.java
    import java.io.Serializable;
    public class ProductPK implements java.io.Serializable
    public String ProductId ;
    public ProductPK(String id)
    this.ProductId = id;
    public ProductPK()
    public String toString()
    return ProductId;
    public int hashCode()
    return ProductId.hashCode();
    public boolean equals(Object Product)
    return ((ProductPK)Product).ProductId.equals(ProductId);

    can u pls tell me u are using ejb1.1 specifications or ejb2.0 specifications.in both cases pls shoe u are descripters so that i can check.

  • BMP-/CMP-Entity Beans with JBoss 3.0 & MySQL 3.23

    Hi @all!
    Sorry, I`m a beginner in development of EJBs, but I`ve got already two of them (a session bean, a cmp-bean with Hypersonic DB) running.
    Now my question:
    Is it possible to develop bmp- or cmp-beans with JBuilder 6.0 and AppServer JBoss 3.0 and MySQL as relational database.
    If anybody here, has ever done this.
    Please contact for one or two short questions like:
    What will I have to do to get MySQL as persistence medium in JBoss?
    What will I have to do to get MySQL by a bmp-entity-bean over JNDI?
    What will I have to do to run my program? ;-)
    I�m always getting error messages like:
    ...no such entity...
    Or:
    ...MyDB not bound...
    Thanks
    Michael

    Now, I`ve done a little step in the right direction:
    It is possible to create CMP-Beans with JBoss 3.0 and MySQL database.
    You just have to put both on the same machine ;-) (Incredible...)
    But now I`ve got problems to implement a bean-managed-persistence Bean with JBoss 3.0 and mySQL.
    If I start my client application, I get the following error messages, although my EJB is correctly deployed:
    -- I`m calling: create(17, max, [email protected])
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
         java.rmi.ServerException: null
    Embedded Exception
    null; nested exception is:
         javax.ejb.EJBException: null
    Embedded Exception
    null
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
         at sun.rmi.transport.Transport$1.run(Transport.java:148)
         at java.security.AccessController.doPrivileged(Native Method)-- Erfolglos: create(17, max, [email protected])
         at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:536)
         at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:250)
         at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:226)
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:136)
         at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
         at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:128)
         at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:108)
         at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:73)
         at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:76)
         at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:185)
         at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
         at $Proxy0.create(Unknown Source)
         at gaestebuch.BMPTestClient.create(BMPTestClient.java:71)
         at gaestebuch.BMPTestClient.main(BMPTestClient.java:309)
    Caused by: java.rmi.ServerException: null
    Embedded Exception
    null; nested exception is:
         javax.ejb.EJBException: null
    Embedded Exception
    null
         at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:119)
         at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
         at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
         at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:104)
         at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109)
         at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
         at org.jboss.ejb.Container.invoke(Container.java:726)
         at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
         at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
         at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
         at sun.rmi.transport.Transport$1.run(Transport.java:148)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:536)
    Caused by: javax.ejb.EJBException: null
    Embedded Exception
    null
         at org.jboss.ejb.plugins.BMPPersistenceManager.createEntity(BMPPersistenceManager.java:246)
         at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:270)
         at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:728)
         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 org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1116)
         at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:257)
         at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:215)
         at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:134)
         at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:79)
         at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:44)
         at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:98)
         ... 19 more
    -- return of create(17, max, [email protected]): null.
    What is my mistake?
    Thanks, Michael

Maybe you are looking for