Re: Re: [JBoss-user] Writing a finder which returns max id used

2001-04-09 Thread Peter Routtier-Wone
pStatement = con.prepareStatement( "Insert into Attribute " + "(ID, Value, Display_Format, Attribute_Switches, Name, Type_ID) " + "Select max(id)+1, ?, ?, ?, ?, ? from Container "); Wouldn't most, if not all, databases handle concurrancy issues in this case?

Re: [JBoss-user] Writing a finder which returns max id used

2001-04-06 Thread danch
[EMAIL PROTECTED] wrote: How about using some creative SQL like: pStatement = con.prepareStatement( "Insert into Attribute " + "(ID, Value, Display_Format, Attribute_Switches, Name, Type_ID) " + "Select max(id)+1, ?, ?, ?, ?, ? from Container ");

RE: [JBoss-user] Writing a finder which returns max id used

2001-04-05 Thread Swarr, Bob
What about java.rmi.server.UID? It has a hashCode() method that returns an integer. -Original Message- From: Peter Routtier-Wone [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 04, 2001 11:45 AM To: [EMAIL PROTECTED] Subject: Re: [JBoss-user] Writing a finder which returns max id

Re: [JBoss-user] Writing a finder which returns max id used

2001-04-04 Thread Peter Routtier-Wone
You can also use the facilities of the database engine to help with this problem. Oracle has sequences which guarantee a unique number even with concurrent access. Sybase has autoincrement columns. Use of the database as a UID dispenser has its merits with respect to the concurrency issue,

Re: [JBoss-user] Writing a finder which returns max id used

2001-04-03 Thread Guy Rouillier
] Sent: Tuesday, April 03, 2001 7:39 AM Subject: Re: [JBoss-user] Writing a finder which returns max id used Wouldn't the easiest solution be to make a select max(key) statement and then add 1 to get your new key? This isn't an EJB question, it's a general concurrency issue. What you say