Hi there,
I have two tables: user and roles. A user can have associated many roles, and this relationship is unidirectional. I want the roles to be fetched automatically, i tried using lazy="false" but that didn't work.
How can I set lazy to false for a many-to-many unidirectional relationship?
Thanks in advance!
Hibernate version: 3.2.6ga
Mapping documents:
Snippet of my User table mapping file (it doesn't work as I expected):
Code:
<bag name="roles" table="USER_ROL" lazy="false">
<key column="USER_ID"/>
<many-to-many class="Rol" column="ROL_ID" lazy="false"/>
</bag>
Full stack trace of any exception that occurs:
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
Name and version of the database you are using: MySQL