A web application using UserTransaction with Hibernate and JBoss EJB. When a user try to delete an entity using em.remove(detachedEntity), then commit transaction, but a Hibernate exception raised: reference constraints violated. In this case, the detached entity is still being hold by JSF backing bean, and user can edit it. When user apply the change using em.merge(), incorrect behavior occured. Either saying the detached entity is stale, or creating duplicate entity, or WrongClassException.
Is there a way to detect reference violation before transaction commit to avoid DB exception? In case of DB(hibernate) exception, Is the detached entity re-usable? Is there a way to make it re-usable? If making a copy of the detached entity and giving the copy to user for editing, user can keep the change after hibernate exception. But deep copy is expensive. There are many types of entities, and implementation of deep copies is not trivial. I am looking for a way to keep detached entities usable even after Hibernate exception raised. Is there a way? Any idea/help are appreciated. Thanks in advance. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3923450#3923450 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3923450 ------------------------------------------------------- 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 JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user