Hi everyone
Assuming I have a bean called Person with an assigned id, the following code will throw a NonUniqueObjectException:
Code:
Transaction tx = session.beginTransaction();
Person person1 = new Person();
person1.setId(new Integer(1));
session.save(person1);
tx.rollback();
Person person2 = new Person();
person2.setId(new Integer(1));
session.save(person2); // throws NonUniqueObjectException
Shouldn't rollback() evict person1 from the first level cache? The only solution I found so far is to manually evict person1 calling session.evict(person1) or session.clear().
Comments from the Hibernate Team would be welcome.
Thanks in advance,
Gabriel.