Hi,

maybe this could come in hand for anyone who wants to use Firebird-incremented IDs 
with CMP and XDoclet:

Supposing you have a table with the PK "ID" as an int:

1. You have to create a generator for each table:

  | create generator gen_TABLENAME;
  | COMMIT;
  | 
2. Tell jBoss via XDoclet that the new ID is generated via the generator:

  |  * @jboss.unknown-pk
  |  *        class = "java.lang.Integer"
  |  *        column-name="id"
  |  *        auto-increment = "true"
  |  *
  |  * @jboss.entity-command
  |  *        name="pk-sql"
  |  *
  |  * @jboss.entity-command-attribute
  |  *        name="pk-sql"
  |  *        value="SELECT gen_id( gen_TABLENAME, 1 ) from RDB$DATABASE;"
  | 
That's it!

Background:
1. There's no Firebird-Keygen-Plugin like "mysql-get-generated-keys" plus 
"org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCMySQLCreateCommand".
2. The "get-generated-keys"-method does not work because the Firebird JDBC driver is 
not JDBC30-ready yet:

  |     public synchronized PreparedStatement prepareStatement(String param1, int 
param2)
  |         throws SQLException
  |     {
  |         throw new SQLException("not yet implemented");
  |     }
  | 
But in the future this would be the better solution.

HTH,

Matthias

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3842965#3842965

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3842965


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to