what a nice solution for logical deletion, thanks for sharing.
one (hibernate) issue i've found is on mapping a "one to many" relation as set property.
Code:
<set name="aSetProperty" >
<key column="COL" />
<one-to-many class="aClass" />
</set>
where
Code:
<class name="aClass" ... where="DELETE_FLAG is null">
in such a case "logically deleted" records are (erroneously) included in set.
in order for this to work as expected (logically deleted records not being included), i had to add again the "where not deleted" attribute as in the following fragment:
Code:
<set name="aSetProperty" where="DELETE_FLAG is null">
<key column="COL" />
<one-to-many class="aClass" />
</set>
thanks again for sharing this idea,
-fb
teek wrote:
I am pretty new to hibernate/nhibernate but shouldnt this work? at least it works for me, and does not look that much as a hack.
Code:
<hibernate-mapping xmlns=”urn:nhibernate-mapping-2.2″>
<class name=”ExampleEO, myAssembly” table=”EXAMPLE” where=”DELETE_FLAG IS NULL”>
<property name=”deleteFlag”>
<column name=”DELETE_FLAG” />
</property>
<sql-delete>UPDATE EXAMPLE SET DELETE_FLAG = ‘*’ WHERE ID = ?</sql-delete>
</class>
</hibernate-mapping>