Guys (especially from Hibernate team),
Can you please insert some code to prevent the NonUniqueObjectExcpetion? I've been trying to use the following but without any luck:
Scenario 1:
// get entity from DB.
// change values.
// update() -> throws NonUniqueObjectException
Scenario 2:
// get entity from DB.
// evict() entity.
// put to HttpSession for later editing.
// get entity from HttpSession and assign new values.
// merge() with Session -> looks like nothing happens here.
// update() or delete() throws NonUniqueObjectException
I forgot most of my trials, but every time I test it, it always throws the same exception.
I have to use the session.update() to separate it from session.save() base on my application logic. This adds validation for new and old persisted objects.
My Application architecture:
Hibernate (Generic DAO Layer)
EJB (Session Facade)
Remote EJBs
JNDI
ServiceLocator
Struts (Controller)
JSP (View)
I'm using Hibernate 3.2 cr5 and Annotations 3.2.0 CR3
_________________ Don't forget to rate.
|