I've been trying to access a lazy initialized set from a class. If I didn't understood wrong, hibernate was supposed to take care about bringing from the database the objects when I called the getSet of the Business Object. I don't know if I'm missing something here, I created a series of interfaces so the rest of my system layers could access the Object, and I implement those in the business object itself (as it should be), but every single time I want to access the data in the sets, I get a:
Failed to lazily initialize a collection - no session or session was closed
I am working with the spring framework and it's supposed to take care of the session managing, si I really don't think the problem is the session getting closed, I think is that I'm skipping maybe some connection between the Business Object and the DAO.
So my question is, can somebody give me a clue on how to wire everything up.
Here's how I have everything wired up.
BaseClass
BaseClassDAO extends _RootDAO
IClass
ClassManager
Class implements IClass
ClassDAO implements ClassManager
here are my mappings:
Code:
<class name="Usuario" table="usuario">
<id name="numerostr" type="java.lang.String" column="numerostr">
<generator class="assigned"/>
</id>
...
<set name="perfils" table="rusuario_perfil" lazy="true">
<key column="numerostr"/>
<many-to-many class="portal.data.Cperfil" column="idperfilint"/
</set>
...
Any kind of help will be greatly appreciated.