Hi,
I'm a kind of trapped. I thought a lot about a smart application design and came up with the following solution:
I got a package (utility) which contains the session manger.
another one which contains folders for entity classes, mappings and Data Access Objects. The later also takes care of calling the session manager.
On top I can put my application classes, which use the two packages "underneath". I think it's nice but it does not work.
Almost all entities have foreign key. Therefore calling a DAO Method GetItems returns me all objects but each one has foreign key relation.
When I want to use this foreign key column there is no session connection, because after the DAO Method returned all objects the session was closed.
example:
Code:
IList result = GetItems(typeof(OrganizationalUnit));
foreach (OrganizationalUnit ou in result)
if (ou.OrganizationalUnitTypeId.ToString() == "group")
ouList.Add(ou);
In this example OrganizationalUnitTypeId is a foreign key. An exception is thrown "Could not initialize proxy - the owning Session was closed."
How could I solve this problem
Thanks for your help in advance
antoschka