The method you have chosen doesn't give unique pk values with more than one
thread/user.

There are many many ways to do this right, including I think an id
generator bean included with jboss.  Look in the archives.

david jencks

On 2002.07.22 13:25:58 -0400 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
> 
> 


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

Reply via email to