Hibernate validation question. I am trying out using only hibernate validation 
for my entity beans, so that I don't have to duplication JSF validators when 
editing the same object on different pages.

I have my user object with children lists (addresses, emails and phone 
numbers). In my SB:

@Valid
private User user;

In the User.java:

        @OneToMany(cascade=CascadeType.ALL, mappedBy="user")
  |     @JoinColumn(name="user_id")
  |     @OnDelete(action=OnDeleteAction.CASCADE)
  |     @Size(min=1, message="You must provide at least one email address")
  |     @Valid
  |     private List<EmailAddress> emails =
  |             new ArrayList<EmailAddress>();
  | 

The user validates fine and all properties of user, but if any of my emails are 
invalid I am getting:
Caused by: org.jboss.tm.JBossRollbackException: Unable to commit, 
tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=null:1139797993207/13, 
BranchQual=null:1139797993207, localId=0:13], status=STATUS_NO_TRANSACTION; - 
nested throwable: (org.hibernate.validator.InvalidStateException: validation 
failed for: org.bethanyefree.data.EmailAddress)
  |         at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:1283)
  |         at org.jboss.tm.TxManager.commit(TxManager.java:587)
  |         at 
org.jboss.ejb3.embedded.UserTransactionImpl.commit(UserTransactionImpl.java:90)
  |         at 
org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener.commit(SeamExtendedManagedPersistencePhaseListener.java:77)
  |         ... 26 more
  | Caused by: org.hibernate.validator.InvalidStateException: validation failed 
for: org.bethanyefree.data.EmailAddress
  |         at 
org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:104)
  |         at 
org.hibernate.validator.event.ValidateEventListener.onPreInsert(ValidateEventListener.java:127)
  | 

How come the @IfInvalid is not catching that child objects of user are invalid?

Thanks

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

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


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to