[jboss-user] [EJB 3.0] - Re: Entity Callback -- @PrePersist vs. @PreUpdate

jaikiran do-not-reply at jboss.com
Wed Jun 11 10:25:32 EDT 2008


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.");
  | }
  |  

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

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



More information about the jboss-user mailing list