-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Issue with EntityExistsException
PostPosted: Tue May 01, 2007 12:43 pm 
Newbie

Joined: Tue May 01, 2007 12:25 pm
Posts: 5
As per our application design, we have been Hibernate EntityManager 3.2.1 in Weblogic Server 10.0.

We do have an EmployeeMaster table where the unique constraint is applied on the Employee 'FIRSTNAME' field of this table. The Employee ID field has been designated as the primary key over here.

While trying to persist a duplicate employee entity (with the same 'FIRSTNAME' that is already as part of the table), the hibernate entity manager seems to throw only the 'org.hibernate.exception.ConstraintViolationException' whereas we were looking for an EntityExistsException as per the documentation.

I have also attached my code snippet below for your reference:

public <T extends PersistenceObject> T create(T pObject) throws LMSException {
try {
this.getEntityManager().persist(pObject);
}
catch (EntityExistsException aEntityExistsException) {
System.out.println("Duplicate Entity Exception:"+aEntityExistsException);
}

return pObject;
}

Can you kindly help me out on how to sort out this issue?

Regards,
Sathish


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.