On 2/26/06, Doug Hughes <[EMAIL PROTECTED]> wrote: > In the case where you're validating that a specific user name has not been > used, I'd also put that in the validate method. You can easily get to the > ReactorFactory via the _getReactorFactory method. You can use that to > create an instance of a UserGateway and you could call > getByFields(username='myusername'). If any rows are > returned then add an error to the validation error collection.
Although that isn't thread safe since two threads could both run the query and get no records back and then both could try the insert. As Phil says, for uniqueness the only way to guarantee it is via the database and catching the exception. Well, another way would be to lock around both the validate() and the save() calls in the controller - thus making a single atomic operation out of the two calls. -- Sean A Corfield -- http://corfield.org/ Got frameworks? "If you're not annoying somebody, you're not really alive." -- Margaret Atwood -- Reactor for ColdFusion Mailing List -- [email protected] -- Archives at http://www.mail-archive.com/reactor%40doughughes.net/

