Quote:
Or in general, shall i change the design a bit to avoid cross thread boundaries with state?
I personally prefer to use
Code:
sf.openSession(); // or emf.getEntityManager() with JPA
instead to
Code:
sf.getCurrentSession();
which corresponds to manual persistence-propagation.
Obviously you then have to pass the returned session between the threads,
I don't understand if you can do this and if it is what you mean with 'cannot pass bean between then'.
Quote:
I can't not pass bean between then.
There are different ways to implement Conversations with Hibernate
(also depending if you use JPA or not, Java SE or J2EE container, etc.).
The book 'Java Persistence with Hibernate' spends a whole chapter (11.2) in this topic,
so it is hard to explain solutions here in few lines.