Another NHibernate tip:
the follwoing error occurs: "Object references an unsaved transient object - save the transient instance before flushing: Object"
when a new (unsaved) object is added into the collection of objects in a parent class and SaveOrUpdate is callled on teh parent.
EG. A seller has a collection of categories and each category has a collection of vouchers. Adding a Voucher to a category and calling SaveOrUpdate on the parent Seller.
To resolve this error ensure that in teh mappniog file the "cascade" is set for each of the properties. so in.
here is the mapping file segment:
<
bag name="Vouchers" table="Vouchers" inverse="false" cascade="all-delete-orphan">
<
key column="CategoryID" />
<
one-to-many class="Voucher" not-found="ignore" />
</
bag>
NB. all-delete-orphan is cascade all save or updates and delete any recordds that are then orphaned due to the parent being deleted. this is not default behaviour if you just cascade all.