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.

Similar Messages

  • How do I create an Entity Bean with unknown primary keys

    Hi,
    Can a good folk help me.
    I am mapping an entity bean to an oracle table for the purpose of logging . I do not need a primary key contraint on this table. How do I specify in my entity bean file descriptor not to use any field for primary key ...
    I have done this so far...
    in my ejb.xml file - I set....
    <prim-key-class>java.lang.Object</prim-key-class>
    and deleted ....
    <primkey-field>...</primkey-field>
    My table structure is .....
    CREATE TABLE FAMS_REQUEST_LOG (
    EDITEDBY VARCHAR2(20),
    OLDTRANSDATE DATE,
    REQUESTID VARCHAR2(30) NOT NULL,
    OLDQTY NUMBER(20),
    NEWQTY NUMBER(20),
    NEWTRANSDATE DATE)
    but I still get this error message on deploying...
    [#|2006-03-01T14:30:29.250+0100|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.tools.deployment|_ThreadID=19;|Total Deployment Time: 11000 msec, Total EJB Compiler Module Time: 0 msec, Portion spent EJB Compiling: 0%|#]
    [#|2006-03-01T14:30:29.265+0100|SEVERE|sun-appserver-pe8.1_02|javax.enterprise.system.tools.deployment|_ThreadID=19;|Exception occured in J2EEC Phase
    com.sun.enterprise.deployment.backend.IASDeploymentException: Fatal Error from EJB Compiler -- JDO74046: JDOCodeGenerator: Caught a MappingConversionException loading or creating mapping model for application 'fixassetenterpriseapp' module 'FixAssetEnterpriseApp-EJBModule': JDO71030: There is no column in table FAMS_REQUEST_LOG which can be used to support the servers implementation of unknown key classes.
    at com.sun.ejb.codegen.CmpCompiler.compile(CmpCompiler.java:274)
    at com.sun.ejb.codegen.IASEJBC.doCompile(IASEJBC.java:615)
    at com.sun.ejb.codegen.IASEJBC.ejbc(IASEJBC.java:563)
    at com.sun.enterprise.deployment.backend.EJBCompiler.preDeployApp(EJBCompiler.java:340)
    at com.sun.enterprise.deployment.backend.EJBCompiler.compile(EJBCompiler.java:209)
    at com.sun.enterprise.deployment.backend.AppDeployer.runEJBC(AppDeployer.java:284)
    at com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:176)
    at com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:107)
    at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:146)
    at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:71)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:633)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:188)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:520)
    at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:143)
    at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:172)
    |#]
    Dotun

    you will have to create a sequence and a trigger
    CREATE SEQUENCE <SEQUENCE NAME>
    INCREMENT BY  1
    START WITH  1
    NOCACHE
    /this sequence will guarantee that each requested number is unique
    the trigger will select from this sequence and insert the obtained value in the new record
    CREATE OR REPLACE TRIGGER <TRIGGER NAME>
    BEFORE INSERT ON <TABLE NAME>
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
        BEGIN
            select
                <SEQUENCE NAME>.nextval
            into
                :NEW.<COLUMN NAME>
            from
                dual;
        END;
    [/CODE]
    this will always take the value from the sequence, even if you already provided a value yourself
    (otherwise you will first have to test if :NEW.<column name> is null, but I wouldn't do this for a key column.
    if you need the generated key back for further processing (inserting it into a child table for example), you can use the returning clause on the insert statement
    see the oracle documentation for more information about sequences, triggers and the returning clause
    greetings
    Freek D
    I am new to Oracle and need to know how to create a table that uses an automatic incrementation on a primay key for it's default. I need the uniqueness automatically managed by the DBMS.. This activity is know as setting the Column (primary key with identity) in Ms-SQL..
    Your help would be appreciated greatly....
    Thanks....

  • 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

  • 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

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

  • CMP Entity Beans with custom finders an primary key class

    Hi everybody.
    I've got a Entity with a primary key class and a custom finder. I've defined
    the finder into the xml file like iPlanet's documentation say, but, when I
    try to run the aplication I get the following error:
    Exception: SERVLET-run_failed: Failed in running template:
    /PruebaGI/PruebaGI/pruebagi.jsp, java.lang.ClassCastException:
    com.netscape.server.deployment.SessionBeanDescriptor
    Exception Stack Trace:
    java.lang.ClassCastException:
    com.netscape.server.deployment.SessionBeanDescriptor
    at
    com.netscape.server.servlet.servletrunner.AppInfo.popWebAppDescriptor(Unknow
    n Source)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    at com.netscape.server.servlet.servletrunner.ServletRunner.callJSP(Unknown
    Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callJsp
    Compiler(Unknown Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callUri
    (Unknown Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callUri
    RestrictOutput(Unknown Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformRequestDispatcher.forward(U
    nknown Source)
    at com.netscape.server.servlet.jsp.JSPRunner.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    at com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown
    Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479).
    Could anybody help my? I need to resolve this question quickly.
    Thx
    ..

    Hi Juan,
    Sounds like you've defined either a java.lang.String where it should have
    said Java.util.Vector (or the other way around) in the part of the
    deployment descriptor that defines your custom finder method parameter.
    Regards,
    Raymond
    "Juan Jos� Ayuso" <[email protected]> wrote in message
    news:[email protected]...
    Hi everybody.
    I've got a Entity with a primary key class and a custom finder. I'vedefined
    the finder into the xml file like iPlanet's documentation say, but, when I
    try to run the aplication I get the following error:
    Exception: SERVLET-run_failed: Failed in running template:
    /PruebaGI/PruebaGI/pruebagi.jsp, java.lang.ClassCastException:
    com.netscape.server.deployment.SessionBeanDescriptor
    Exception Stack Trace:
    java.lang.ClassCastException:
    com.netscape.server.deployment.SessionBeanDescriptor
    at
    com.netscape.server.servlet.servletrunner.AppInfo.popWebAppDescriptor(Unknow
    n Source)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    atcom.netscape.server.servlet.servletrunner.ServletRunner.callJSP(Unknown
    Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callJsp
    Compiler(Unknown Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callUri
    (Unknown Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callUri
    RestrictOutput(Unknown Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformRequestDispatcher.forward(U
    nknown Source)
    at com.netscape.server.servlet.jsp.JSPRunner.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    atcom.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown
    Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479).
    Could anybody help my? I need to resolve this question quickly.
    Thx

  • Problem With Compound Primary Key

    Hello Experts,
      i am facing some probelm with copound primarykey.
      the Probelm is
    i have data base table which has compound primary key  for that one i have created the entity bean(CMP) and primary key of type compound.using this i am able to insert record into databse but for updation i am using
    <b>findbyPrimarykey()</b> method ,for that methos i am passing
    primary key object with compound key values.
    when i am executing this methos it is throwing <b>nosuchobject exception.</b>
    what might be the problem
    any help will be appriciated
    thanks in advance
    With Regds
    Naidu

    Hi,
    Is ur compound primarykey class is something like this?
    public class PrimaryKey implements java.io.Serializable {
          public String id = "";
          public int no = 0;
          //a default constructor is required:
          public PrimaryKey() { }
          // optional constructor fo clients:
          public PrimaryKey(String id, int no) {
               this.id = smsId;
               this.no = no;
          public String toString() {
               return id + "" + no;
         public boolean equals(Object obj) {
              if (obj == null || !(obj instanceof PrimaryKey))
                      return false;
                   else if ((((PrimaryKey)obj).no == no) && (((PrimaryKey)obj).id.equals(id)))
                      return true;
                   else
                      return false;     
          public int hashCode() {
                return id.hashCode() + no ;

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

  • Insert values of form on a table with compound primary keys in APEX

    Good evening,
    I have a table with compoud primay keys. On ER model I had a many to many relation and when I coverted to relational model I've got a table with the primary keys of the two entities.
    My problem now is that I am trying to build an APEX application with a Form/Report and I want to insert a tuple both on the "entity" and on the table with two primary keys.
    I created a trigger with
    CREATE OR REPLACE TRIGGER ins_key_elem
    INSTEAD OF INSERT
    ON v_key_elem
    REFERENCING NEW AS NEW
    FOR EACH ROW
    BEGIN
    INSERT INTO elem_type (elem_key, type_key)
    VALUES (:NEW.elem_key, :NEW.type_key);
    INSERT INTO elem(elem_key, name)
    VALUES (:NEW.elem_key, :NEW.name);
    END;
    Is that ok? If it is, now how I can use that trigger to do what I need? i.e. insert the tuple on the two tables when I use the create button of the form
    Edited by: 934530 on May 15, 2012 2:36 PM

    Nevermind...figured it out. Was able to set the value on the Report Attributes page.

  • 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 database specific features

    Hi there,
    I�m studying Entity Beans and I'm doing some experiences with SQL Server.
    At first, I built a CMP Bean and marked in deploytool to create the tables. Ok, it worked.
    Now, I'm trying to interact to an existent database. But, I got a problem: the primary key is defined by the Server. I can read it and I can remove entries. But, when I try to insert some entry, I can't pass the key in SQL statement. I edited the generated statement to do it, but it doesn't work. I get a RollbackException.
    My question is: is it possible to do what I'm intending to do with CMP? What am I doing wrong?
    Do you think that, to do this, I should use BMP Entity beans?
    Thanks in advance,
    Anicio

    "CMP provides you with database independence and less coding efforts."
    BMP is not database dependent, unless you invoke database specific things in your SQL (something I do not do). CMP on the otherhand is inherently appserver specific (which was it's goal when BEA, IBM, et al. came up with it), and still limits your design possibilities. See this thread for an example:
    http://forum.java.sun.com/thread.jsp?forum=13&thread=318785
    As for less coding effort, that is a relative statment. Yes a simple CMP bean requires less coding to develop the first time. I personally view a few lines of SQL to load and store the data as being fairly trivial. But that needs to be offset with the problems inherent in using appserver specific CMP implementations.
    As an example, try mapping WebSphere CMP to a pre-existing database without using IBM's IDE. It's an incredible pain in the ass since WebSphere does not come with a "meet-in-the-middle" solution. Any J2EE developer that has had the experience of working with different appservers (especially if they have had to port an app, as I have) can attest to the complications that arise with each implementation.
    A BMP bean, written with non-DB-specific SQL, is the most portable, most flexible approach to EntityBeans. Yes, it requires the developer to be able to write some SQL, which should not take a significant amout of time. WRT queries, you have to write them, either SQL, EQL, or some appserver specific format.
    As an aside, the use of code generators to simplify the creation of EJBs lends itself well to BMP. By using a (or writing your own) code generator, you can mitigate the annoying SQL bugs that creep up early in development.

  • Problem with update of BLOB field in a table with compound primary key

    Hi,
    I've been developing an application in Application Express 3.1.2.00.02 that includes processing of BLOB data in one of the tables (ZPRAVA). Unfortunately, I've come across a strange behaviour when I tried to update value in a BLOB field for an existing record via a DML form process. Insert of a new record including the BLOB value is OK (the binary file uploads upon submiting the form without any problems). I haven't changed the DML process in any way. The form update process used to work perfectly before I'd included the BLOB field. Since than, I keep on getting this error when trying to update the BLOB field:
    ORA-20505: Error in DML: p_rowid=3, p_alt_rowid=ID, p_rowid2=CZ000001, p_alt_rowid2=PR_ID. ORA-01008: not all variables bound
    Unable to process row of table ZPRAVA.
    OK
    Some time ago, I've already created another application where I used similar form that operated on a BLOB field without problems. The only, but maybe very important, difference between both the cases is that the first sucessfull one is based on a table with a standard one-column primary key whereas the second (problematic one) uses a table with compound (composite) two-column PK (two varchar2 fields: ID, PR_ID).
    In both cases, I've followed this tutorial: [http://www.oracle.com/technology/obe/apex/apex31nf/apex31blob.htm]).
    Can anybody confirm my suspicion that Automatic Row Processing (DML) can be used for updating BLOB fields within tables with only single-column primary keys?
    Thanks in advance.
    Zdenek

    Is there a chance that the bug will be included in the next patch?No, this fix will be in the next full version, 3.2.
    Scott

  • 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

  • CMP entity beans with netbeans 6.7.1

    package m;
    import javax.ejb.CreateException;
    import javax.ejb.EntityBean;
    import javax.ejb.EntityContext;
    public java.lang.String ejbCreate(java.lang.String key) throws CreateException {
    if (key == null) {
    throw new CreateException("The field \"key\" must not be null");
    // TODO add additional validation code, throw CreateException if data is not valid
    return null;
    public void ejbPostCreate(java.lang.String key) {
    // TODO populate relationships here if appropriate
    public abstract String getUsn();
    public abstract void setUsn(String usn);
    public abstract String getFname();
    public abstract void setFname(String fname);
    public abstract String getLname();
    public abstract void setLname(String lname);
    public abstract String getAddress();
    public abstract void setAddress(String address);
    Hi all.The above code is generated by netbeans 6.7.1. I am using java db and j2ee 1.4. I am new to ejb. All the cmp fields are mapped correctly,but there is no respective ejbcreate() method.Is this the problem of IDE ? Because i have tried the same thing at my friends place who has netbeans 5.0 it worked fine. I changed the method with valid arguments in the beanclass and home interface.But at run time its throwing rollback exception. Please help me.I'm not finding any guide or tutorial to sort out this.Thanks in advance.
    Edited by: M.P on Sep 16, 2009 10:47 AM

    Pretty please, switch to JEE5 if you can. It is so much easier, so much more efficient and far less frustrating. Not only that, but you'll have far more chance of getting help as most people have happily forgotten about the old nightmare specs.

Maybe you are looking for

  • Loop in combination with Analog output

    Hi I have modified the script thats translate a value in to a static analog output voltage. The value comes from another online running application. The analog output value must remain static until a new value arise. I'm using VB6 and DAQmx 8.5 on a

  • Bloggie MHS-FS3

    Hi, I just bought a Bloggie MHS-FS3 and I just had a terrible experience with the online support, one hour of question and nothing, please forgive e if I'm not in my best mood right now. My Bloggie is connected wth my computer ad my computer is conne

  • [Solved] Xmobar UTF-8 problems

    Hey Folks! I've recently migrated from Debian, and I'm trying to use the same .xmobarrc I wrote for that installation in Arch.Debian did a bit more hand-holding and had a precompiled binary available in it's repo with all of the bells and whistles co

  • PowerShell - Variable Evaluation in Return

    OK, so I'm working with the registry, specifically the user's %PATH%. I am creating user variables, and adding these variables to the PATH.  I would like to be able to query the registry, but see the variable name's, not what they evaluate to. For ex

  • RNIF Service Header data

    Hi experts,     Can somebody help me in finding how to get the RNIF Service Header data in XI, when i get a message from a RNIF compliant system? Regards, Ravi