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

matt.drees do-not-reply at jboss.com
Mon Aug 13 19:30:58 EDT 2007


As far as keeping validation logic in the entity itself, you can do something like this:


  | @Entity
  | @Name("foo")
  | @Table(name = "foo")
  | public class Foo implements Serializable {
  | ...
  |   @AssertTrue(message = "{invalid.nonRepeatCycle.message}")
  |   public boolean isNonRepeatCycleValid() {
  |     return nonRepeatCycle > 0;
  |   }
  | ...
  | }
  | 

It seems to me you're better of using Hibernate's validation framework rather than creating your own; I imagine you'd end up duplicating a lot of it.

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

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



More information about the jboss-user mailing list