That will depend on transaction isolation level you declare.
On a side note - there are few PK generation algorythms you
might want to take a look at, HIGH-LOW for example.

Dimitri
http://dima.dhs.org


On Mon, 11 Sep 2000, Dan Hinojosa wrote:

> Well lets say I have a customers table.  In a session bean I have this
> function that creates an ID for me.  Do I have concurrency problems with
> this?
>
> private int getID() throws SQLException, NamingException {
>     Connection conn = getConnection();
>     Statement stmt = conn.createStatement();
>     ResultSet rs = stmt.executeQuery("SELECT MAX(ID+1) FROM CUSTOMERS");
>
>     rs.next();
>     int i = rs.getInt(1);
>     stmt.close();
>     return i;
> }
>
> It works like a champ.  Granted I need better handling of the
> Exceptions.  But the question is concurrency will this pose a problem?
>
> P.S. If anyone is a manager of this newsgroup I always get a legg@...
> someone or rather is not a valid email box.  Can someone drop this
> person?
>
> --
>
> Dan Hinojosa
> Java & Lotus Notes Consultant
> Java Certified Programmer
>
> P.O. Box 4675
> Albuquerque, NM 87196-4675
> Telephone: (505) 262-0911
> Email: [EMAIL PROTECTED]
> WWW: http://www.digitalpriest.com
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to