There's no concurrency problem with what you are doing, because you are only
reading data here.

I suppose that you want to perform an update before doing your select. if this
is the case, you will have to make sure that you lock the db record while
performing both the update *and* the read. This will depend on your DB and
isolation level you use.

jim

----- Original Message -----
From: "Dan Hinojosa" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 11, 2000 10:45 AM
Subject: Concurrency.


> 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