Hibernate version:
NHibernate-1.2.0.Alpha1
Mapping documents:
Just a example:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class
name="DBA.DomainModel.DomainObjectsImpl.AdNode, DBA.DomainModel.DomainObjectsImpl"
table="tblAdNode"
proxy="DBA.DomainModel.DomainObjectsAPI.IAdNode, DBA.DomainModel.DomainObjectsAPI">
<!-- Keys -->
<id name="Identity" column="AdNodeId" type="System.Guid" >
<generator class="guid" />
</id>
<!-- Versioning -->
<timestamp name="Created" />
<!-- Properties -->
<property name="ModifiedBy" type="System.Guid"/>
<property name="CreatedBy" type="System.Guid"/>
<!-- Relations-->
<bag name="Children" lazy="true" inverse="true" cascade="all">
<key column="Parent" />
<one-to-many class="DBA.DomainModel.DomainObjectsImpl.AdNode, DBA.DomainModel.DomainObjectsImpl" />
</bag>
<many-to-one
name="Parent"
cascade="all"
class="DBA.DomainModel.DomainObjectsImpl.AdNode, DBA.DomainModel.DomainObjectsImpl" />
</class>
</hibernate-mapping>
I'm currently trying to use ASP.NET 2.0's http-session in conjunction with lazy loaded collections.
I've read elsewhere on this board that if you want to serialize, you should'nt use lazy-loading. But in this case we simply have to lazy-load - if we don't we'll almost load the entire database per-page request.
So when I add the objects to the session, it also seems to add the proxy-stubs without any problems - is there any way to hook up those stubs again (on deserialization)?
And if there is, can the hook-up be automatic? So I don't have to know what collections to hook up on my parent object, but just calls some function with the parent.
I would like to avoid going down the reflection-road, but I'm guessing that could be a way - iterating over any collections and hooking them up one by one.
It should be noted, that the objects that I serialize does not come from nhibernate - they just have references to objects that do.