Hello Rahul, this is meant to be used with databases that support sequences. Of course, the example I wrote is not safe and shouldn't be used in a real project. The SQL query I wrote should be substituted with a statement that will safely return unique keys.
alex Wednesday, November 20, 2002, 5:57:59 AM, you wrote: RR> Alex, RR> I am referring to ur database generated key method. RR> <!-- database generated keys --> RR> <unknown-pk> RR> <unknown-pk-class>java.lang.Integer</unknown-pk-class> RR> <column-name>genid</column-name> RR> <jdbc-type>INTEGER</jdbc-type> RR> <sql-type>INTEGER</sql-type> RR> </unknown-pk> RR> <entity-command name="pk-sql"> RR> <!-- this sql is dummy, some sequence tables should used here --> RR> <attribute name="pk-sql">SELECT MAX(genid)+1 FROM myjdbc_table</attribute> RR> </entity-command> RR> Here eventhough the select statement 'SELECT MAX(genid)+1 FROM myjdbc_table' runs in a transaction, it never places any lock. RR> So many transactions running concurrently might get the same Max_ID as a result, which might result in the same primary keys. RR> Is it like that, i have not tried it. RR> Rahul -- Best regards, Alex Loubyansky ------------------------------------------------------- This sf.net email is sponsored by: To learn the basics of securing your web site with SSL, click here to get a FREE TRIAL of a Thawte Server Certificate: http://www.gothawte.com/rd524.html _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user