Yes, but my name is no defined as a PK and i don't want to use unicity constraint (in fact i don't know if the default jboss database manages it, the @pk-constaint tag has no effect.

Moreover, if your name is defined as a PK, you don't need any more to check the unicity and you have a wrong design with some rules managed by the db tier.
At least, i've been said that the ejb server can delay the call to ejbstore. In this case you get your ?exception after the call (at the end of the transaction i guess) of the create function which can be difficult to manage.

[EMAIL PROTECTED] wrote:
If the name is defined as a PK I think you shouldn't have any problem...

On Tue, 2003-07-29 at 03:46, Jean-philippe VIGNIEL wrote:
  
What appens if two persons create the same object at the same time. With 
the default transaction mode, i think  (but i can be wrong) that the 
object can be created twice.

By example;

User1: select * from object where name="bob"->nothing  so it's ok
User2: select * from object where name="bob"->nothing so it's ok
User1: create "bob"
User2: create "bob"
User1: close transaction
User2: Close transaction

And there are two bob objects within the database.


Before EJB tomanage this case we did a select for update. Perhaps it's 
possible to set the transaction mode to serialized for the create method???

Thanks for your advice about with subject?


    

  

Reply via email to