Status: New
Owner: ----

New issue 765 by [email protected]: Lazily loaded collections has no session if method is not marked @Transactional
http://code.google.com/p/google-guice/issues/detail?id=765

Description of the issue:

Encountered a problem with how lazy loaded collections were workng. When I request collection data in the processing I'm getting:
{{{
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: ..., no session or session was closed
}}}

I've found that there's no session in hibernate's PersistentBag I access. I've tried to mark method as @Transactional and it worked to my confusion.

I really dislike the solution as my *data-reading* method may now modify underlying data as a side-effect.



Steps to reproduce:
1. Create a class with lazily loaded collection (N-N in my case).
2. Query the data so the lazily loaded collection field wasn't fetched
3. Try to iterate over collection
4. org.hibernate.LazyInitializationException is thrown

Guice-Persist 3.0
Hibernate 3.6.10.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice-dev.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to