Thanks for your reply. My entity does have the relevent field annotated as unique
| @Column(nullable=false, unique=true) | public String getUsername() { | return username; | } | | public void setUsername(String username) { | this.username = username; | } | and I have a em.flush() in my session bean. As I mentioned before, the Exception is caught by my session bean. org.hibernate.exception.ConstraintViolationException but then I get: 16:37:20,640 ERROR [AssertionFailure] an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session) | org.hibernate.AssertionFailure: null id in com.sega.kongo.entity.user.KongoUser entry (don't flush the Session after an exception occurs) This makes some sense to me...because the creation of the User failed, the 'id' will indeed be null. I tried to rollback the transaction (in the 'catch' block of my session bean em.getTransaction().rollback(); but that failed miserably with the following exception message: Illegal to call this method from injected, managed EntityManager Just to make sure that this isn't a potential bug in JBoss, with which version of JBoss have you successfully applied this strategy? I'm using jboss-4.0.3SP1. Thanks as always, Jason View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3918186#3918186 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3918186 ------------------------------------------------------- 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