Dimitri, As someone already pointed out, your pk generation strategy might not gaurentee absolutely unique integers under concurrent access situations. This problem has been debated extensively on different forums/lists and you can find the concise results of those discussions by taking a look at Floyd Marinescu's 'EJB Design Patterns' book at http://theserverside.com/ - it has a whole chapter on this with three different strategies of which the first two, I think, might be useful to you.
HTH, Binil On Mon, 22 Jul 2002, Dimitri PISSARENKO wrote: > Hello! > > I have a table in a mySQL database which I access through JBoss 3.0.0 > (by means of CMP entity beans). > > In this table I have an integer primary key. When creating a new > record in the table, I have to generate a new primary key with the > query > > SELECT MAX(projectPrimaryKey)+1 FROM projects > > This query is executed by a session bean which manages the CMP entity > bean associated with the projects table. > > Is it somehow possible to let JBoss do this query or implement it in > a database-independent manner? That is, that I have absolutely no SQL > statements in my source code. > > Is it perhaps possible to put the code in some configuration file of > the bean? > > Thanks > > Dimitri Pissarenko > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user > -- And did they get you to trade your heroes for ghosts? Hot ashes for trees? Hot air for a cool breeze? Cold comfort for change? And did you exchange a walk on part in the war for a lead role in a cage? - PF ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user