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?
[EMAIL PROTECTED] wrote:
How about using a finder method in the Session Bean like the following.
We have defined a customized finder method (findByIdOrEmail) that checks
that user name or email exists in database.
try {
home.findByIdOrEmail(user_name, email);
throw new CreateException("User name or email already exist");
}
catch ( FinderException f ) {
/* username and email are new, create user */
UserValue uv = new UserValue(user_name, first_name, last_name, email, password);
UserLocal user = home.create(user_name, uv);
return user.getId();
}
The ejbdoclet code for the finder method:
@ejb:finder signature="User findByIdOrEmail(java.lang.String id, java.lang.String email)" query="SELECT DISTINCT OBJECT(user) FROM User As user WHERE user.id=?1 OR user.email=?2"
On Mon, 2003-07-28 at 07:16, Jean-philippe VIGNIEL wrote:
Hi everybody
I have to check that a name is unique before creating or updating this object. How can i do that without using a database constraint and without concurrency problem?
The jboss pk-constraint tag set the constaints on the database, is there something to do the same thing managed by the container?
Thanks for your help
Jean-Philippe
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user
------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user
