Possible Duplicate:
Hibernate: different object with the same identifier value was already associated with the session
I tried to save two entity once:
session=....getCurrentSession();
Book bo1=new Book();
bo1.setName("name1");
session.save(bo1);
Book bo2=new Book();
bo2.setName("name2");
session.save(bo2);
Then I get a exception:
a different object with the same identifier value was already associated with the session.
Seems that the bo2′ identifier exist (the bo1’s identifier), I wonder why?
BTW, I really want to know more about the session in hibernate, any docs? I have read the tutorial of hibernate, but it is not detailed enough.
You need to provide Book mapping. I difficult to know what can happen behind the scenes if you just show some snippet of code. We help you if you help us. But a good intro to SessionFactory/Session is shown here. Good lucky!