DB generated primary keys and CMP

Discussions

EJB programming & troubleshooting: DB generated primary keys and CMP

  1. DB generated primary keys and CMP (3 messages)

    DB generated primary keys and CMP

    If i have an auto-incrementer (in MySQL) and i insert the new data in this method, how can i appoint the primary key value for CMP Entity Bean?

    i find a method from BEA weblogic support doc:

    Generated primary key support for Microsoft SQL Server databases uses SQL Server's IDENTITY column. When the bean is created and a new row is inserted in the database table, SQL Server automatically inserts the next primary key value into the column that was specified as an IDENTITY column.

    Figure 5-10 Specifying automatic key generation for Microsoft SQL


    <automatic-key-generation>
    <generator type>SQL_SERVER</generator-type>
    </automatic-key-generation>


    it is automatic key generation for MSSQL server, but can i use this method for MySQL??? ( MySQL also uses the IDENTIY keyword ).

    Many Thanks!!!!

    Threaded Messages (3)

  2. DB generated primary keys and CMP[ Go to top ]

    Hi,
    I think it works for MS SQL server because the jdbc driver supports the new JDBC spec where you can obtaining the generated keys (as specified in java.sql.Statement.getGeneratedKeys()). I am not sure if the MySql jdbc driver supports this, so this might be the cause of your problem.
    Best regards,Mircea.
  3. DB generated primary keys and CMP[ Go to top ]

    DB generated primary keys and CMP

    >
    > If i have an auto-incrementer (in MySQL) and i insert the new data in this method, how can i appoint the primary key value for CMP Entity Bean?
    >
    > i find a method from BEA weblogic support doc:
    >
    > Generated primary key support for Microsoft SQL Server databases uses SQL Server's IDENTITY column. When the bean is created and a new row is inserted in the database table, SQL Server automatically inserts the next primary key value into the column that was specified as an IDENTITY column.
    >
    > Figure 5-10 Specifying automatic key generation for Microsoft SQL
    >
    >
    > <automatic-key-generation>
    > <generator type>SQL_SERVER</generator-type>
    > </automatic-key-generation>
    >

    What is your application server????
    We are using WebSphere 5.0 and MSSQLS and this feature would seem not to be available

    >
    > it is automatic key generation for MSSQL server, but can i use this method for MySQL??? ( MySQL also uses the IDENTIY keyword ).
    >
    > Many Thanks!!!!
  4. DB generated primary keys and CMP[ Go to top ]

    i am using WebLogic 7.0 and MYSQL DB server 4.0