Hi,
As far as I understood it, the lazy loading of collections by default predates the version 1.2.x (so it should also be lazy by default for 1.0.3).
Since version 1.2.x your class itself will be lazy by default : which means that for your class a proxy might be created under certain circumstances unless you specify lazy=false on class-level.
For example:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="classname" table="tablename" [b]lazy="false"[/b]>
<property name="prop1" column="prop1col" type="String"/>
<many-to-one name="association" column="association_id" class="Association"/>
<set name="Collection" lazy="true" cascade="all-delete-orphan" inverse="true">
<key column="class_id"/>
<one-to-many class="anotherclassname"/>
</set>
</class>
</hibernate-mapping>
NHibernate will create proxies for your classes unless they're marked as being lazy. Note that this applies to associations, not collections. Fetching a collection should always return the objects themselves not a proxy.
You'll find an example of such an association above ("Association"). In the example above, if class 'Association' was marked lazy=true you'll get a proxy to Association, otherwise you'll get an Association-object.
This means that:
a) if you get an object A that is marked as being lazy=true, you'll get that object A
b) if that object A references itself another object B that is being marked lazy=true, your object A will contain a proxy to that referenced object B (the proxy of B will only be initialized when you first call one of it's properties).
c) if your object A has a collection of objects C that are marked as lazy=true and you initialize that collection, you'll get a collection of objects C (not proxies).
Please rate this post if it helped.
X.