[jboss-user] [JBoss Seam] - modify entity after persist from same method

jsutherland do-not-reply at jboss.com
Wed Jan 23 18:34:25 EST 2008


Just wondering if it is possible to change a newly persisted entity instance (from EntityHome) in the same action method.  

I can't seem to find any information about this anywhere.    It is certainly hibernate related..

My action method injects 3 types of EntityHome objects  

My problem is that I have to create these 3 different entities (one of each type) in this action and they all refer to each other but they need to be persisted in a certain order.  So after they are all persisted I need to modify some of the relations on the new entities.  Whenever I add these new relationships I get an exception:

[lifecycle] #{Register.registerUser}:  avax.ejb.EJBTransactionRolledbackException: validation failed for: com.example.User
...

Caused by: org.hibernate.validator.InvalidStateException: validation failed for: com.vivapop.calendar.entity.User
	at org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:143)
	at org.hibernate.validator.event.ValidateEventListener.onPreUpdate(ValidateEventListener.java:172)
	at org.hibernate.action.EntityUpdateAction.preUpdate(EntityUpdateAction.java:217)
	at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:65)
	at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)


Is it possible to do the updates in the same action after persist?  If not there must be another approach that I can't see?  


Thanks for any input.


Jon


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

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



More information about the jboss-user mailing list