robert2004 wrote:
It seems Hibernate is trying to insert the second one with the same ID as the first one.
Yes, that would be my guess too.
Quote:
Does this thing have anything to do with Thread Local? I didn't use that pattern,
Syntax error.
How do you generate your id:s? While you're at it, post your mapping documents (the .hbm.xml file(s)) too.
Another thing, if the code you showed is pulled straight from your system you're going to have VERY bad performance. Rebuilding the session factory for every database operation will produce massive overhead.