[jboss-user] [JBoss Seam] - Re: How to display exception messages for fields

ellenzhao do-not-reply at jboss.com
Mon Aug 13 13:43:20 EDT 2007


"pete.muir at jboss.org" wrote : Why not use hibernate validators?

1. There is less stuff to configure if I integrate the "validator" into the entity itself

2. This approach works really well with Seam when the entity travels between layers/tiers. The setter is the _only_ place where validation code is needed. In the conversation bean, I call setters of entities anyway....

3. In fact the validity of the fields belongs to business logic. The entity class is much more reusable if this business logic is contained in itself. Otherwise, the validity logic is contained in the hibernate validator, the hibernate validator dependency sneaks in....

4. The exception classes becomes a central error repository. With this approach, the view code only needs to react to POJO business exceptions....And in the message bundle, I can write localized error messages according to the type of exceptions. I prefer the concept of a business exception (which is caused by incorrect user input and recovable)  to the concept of "validation exception".  



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4073667#4073667

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4073667



More information about the jboss-user mailing list