[hibernate-dev] [BV] Though about PatternValidator

Emmanuel Bernard emmanuel at hibernate.org
Wed Jun 24 07:44:50 EDT 2009


I'd rather see frameworks understand that "" is not equivalent to  
null :)
I know Oracle DB does not think that way but any decent human being  
does.



On  Jun 24, 2009, at 13:25, Alaa Mohsen wrote:

> It was just a thought so that the developer doesn't have to handle  
> such cases himself.
> regards
> Alaa Nassef
>
> On Wed, Jun 24, 2009 at 11:19 AM, Hardy Ferentschik <hibernate at ferentschik.de 
> > wrote:
> If you want to allow the empty string you can start your regular  
> expression with the 'empty' or operator '|', eg "|^.*foo.*$".
> Now the string can be empty or anything with foo in it.
>
> --Hardy
>
>
> On Wed, 24 Jun 2009 09:47:56 +0200, Alaa Mohsen <alaa.mohsen at egyptdc.com 
> > wrote:
>
> Hello All,
> I just realized that PatternValidator checks if the String passed to  
> it
> is null or not before checking it's validity, but it doesn't check  
> if the
> String is empty. What if someone wants to put a regular expression
> constraint on a non mandatory field, and the framework he uses sets  
> this
> empty field to an empty string? What do you think?
>
>
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-dev/attachments/20090624/4f290248/attachment.html 


More information about the hibernate-dev mailing list