|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
ValidateUniqueness at the property levelHi,
Is there a way to @ValidateUniqueness(property = "something") on the property level? Something like the hibernate @NotNull validator. I don't see one in trails or hibernate APIs. I don't mind the class level @ValidateUniqueness but I have more than one property that have to be unique for a particular domain. Just using unique = true in the @PropertyDescriptor throws a scary exception at the user. Or do I have to write my own hibernate validator and integrate it with tapestry's error reporting in trails? Regards, -- GH |
|
|
Re: ValidateUniqueness at the property levelHi Ghislain
I'm sorry but there is currently no way to do what you want without some extra code. It's very difficult (almost impossible) to catch that "scary" exception to present it in a user friendly format because it's a low level DB exception and the "Open session in view" pattern gets in the the way. Three options I can think of: * As you said: one option is to create your own Hibernate validator. * Try to catch the low level DB exception clossing the transaction and flushing the DB session on save, without waiting for the "Open Session In View" to do it. * Modify the ValidateUniqueness annotation and the ValidateUniqueAspect to allow more than one "unique" property. I think this will be the faster way to do what you want. Saludos. Alejandro. On Fri, Jul 10, 2009 at 6:43 AM, ghachey<ghachey@...> wrote: > > Hi, > > Is there a way to @ValidateUniqueness(property = "something") on the > property level? Something like the hibernate @NotNull validator. I don't > see one in trails or hibernate APIs. I don't mind the class level > @ValidateUniqueness but I have more than one property that have to be unique > for a particular domain. Just using unique = true in the @PropertyDescriptor > throws a scary exception at the user. Or do I have to write my own > hibernate validator and integrate it with tapestry's error reporting in > trails? > > Regards, > > -- > GH > -- > View this message in context: http://www.nabble.com/ValidateUniqueness-at-the-property-level-tp24421725p24421725.html > Sent from the Trails - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: ValidateUniqueness at the property levelThanks Alejandro,
Yes I will go with 1st or 3rd option. Will post result if it can help anyone too. Salut, -- GH
|
| Free embeddable forum powered by Nabble | Forum Help |