> Can you elaborate on how you do unique username type of validation if
> you don't let the db throw the unique key error? Seems like you might
> have to implement some locking scheme?
Transactions. Since the entire operation (BO validation and
persistance) happens as a single call to the business layer, it's all
in a single transaction. Another reason for not putting this stuff in
the input validation - that forces you to have per-request
transactions, which generally isn't what you want.
some psuedo code for the method in the service object:
function addUser(username, password)
throws ValidationException
{
start transaction;
var bo = userFactor.getNewUser();
bo.setUsername(username); // throws ValidationException if invalid
bo.setPassword(password); // throws ValidationException if invalid
persist(bo);
commit transaction;
}
cheers,
barneyb
--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/blog/
I currently have 0 GMail invites for the taking
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]