Hello Marco,

if the problem really is a primary key generation you could consider
entity-commands in JBoss-3.2.
The options are:
- database key generation (sequences, etc);
- custom sql;
- you can supply your own key generator class that will be asked for
  the next key;
- JDBC3.0 PreparedStatement.getGeneratedKeys().

alex

Thursday, June 26, 2003, 1:06:43 AM, Marco Tedone wrote:

MT> Sorry guru for the [silly] question: I am having a discussion with people in
MT> my project regarding the container work with CMP entity beans. More
MT> specifically, we want to implement a Numerator table to assign numbers to
MT> several entities of our model.

MT> Suppose a client wants to assign a value to a peopleId field in a People
MT> table, then it will in order:

MT> 1) Access the Numerator table (behind a CMP entity bean)
MT> 2) Retrieve the value from the number field;
MT> 3) Assign that value to peopleId
MT> 4) Increment the value by 1

MT> What I am saying to the guys in the project is that the container (Jboss in
MT> our case) could ensure that, from the moment when the number is retrieved to
MT> the moment when the number is  incremented by 1 nobody else will be able to
MT> alter the value of the number field in the Numerator table. Someone is
MT> replying that we should implement a synchronized method. Is that really
MT> necessary? I'm quite sure that there is a way to instruct the container to
MT> 'lock' in a certain sense the value of the number field. One way could be a
MT> transaction (shall we use synchronization in this case?); is there anything
MT> simplier?

MT> Many thanks for your time,

MT> Marco



-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to