This content has been marked as final.
Show 2 replies
-
1. Re: Entity Callback -- @PrePersist vs. @PreUpdate
jaikiran Jun 11, 2008 10:25 AM (in response to john_hedden)Looks like when you call the merge, the "flush" happens at the end of the transaction. And the @PrePersist gets called through the transaction callback methods. As a result your IllegalStateException gets wrapped into a RollbackException. Try this:
if (order.getId() != null) { entityManager.merge(order); //flush immidiately entityManager.flush(); FacesUtil.addInfoMessage("Order Number: " + order.getOrderNumber() +" was successfully updated."); }
-
2. Re: Entity Callback -- @PrePersist vs. @PreUpdate
john_hedden Jun 12, 2008 2:23 PM (in response to john_hedden)that makes complete sense. Let me give it a shot. Thanks.