I load a Person.class which have an one-to-many dependency to an Address.class. When I call person.getAddresses I get an org.hibernate.LazyInitializationException.
I have found a solution for my junittest and add the following code in the setUp() and tearDown() method :
It works fine. After that I have read the javadoc of the class TransactionSynchronizationManager and find the followig text passage : "To be used by resource management code but not by typical application code. " The documentation of spring says smth. similiar.
Now my question : Is there a better way to get the same behavior in my junittest than using TransactionSynchronizationManager ?