tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jay Gardner" <...@qwest.net>
Subject RE: saving object
Date Sun, 07 Apr 2002 07:02:26 GMT
What database are you using?



-----Original Message-----
From: seapwc@halcyon.com [mailto:seapwc@halcyon.com]
Sent: Saturday, April 06, 2002 9:15 PM
To: Tomcat Users List
Subject: Re: saving object

I have done this with some row_id defined to be auto-insert on mysql.
With auto-insert you know it will be unique but might want to make
that a constraint.

insert .....blah blah
select max(row_id) - yields the number of the last tx.



row_id is just an example for your purpses.
Good luck

At 01:41 PM 4/5/02, you wrote:
>a little bit off topic.
>
>I have a table with each row corresponds to a javabean object. The objects
>don't
>necessarily have a primary key, so i use a sequence number as its primary
>key, and a
>trigger to assign the sequence number to its ID column when a new object is
>inserted
>into the database.
>
>However, after I insert the object into the table, how can i know the
>object's ID in the
>table?  If I simply do a "..._seq.cur_val",   it is not safe when multiple
>users can access
>the database and save their javabean into it at the same time.
>
>How could you guys accomplish that?
>
>
>--
>To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
>Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message