views:

137

answers:

0

Hi,I have the following mapping:

Person class mapping:
<hibernate-mapping ...>
  <class="my.Person" table="PERSON" where="deleted is null">
    ...
    <sql-delete>
     update PERSON set deleted = true where id=?
    </sql-delete>
  </class>
</hibernate-mapping>

Geek class mapping:
<hibernate-mapping ...>
  <joined-subclass name="my.Geek" table="GEEK" extends="my.Person">
    ...
  </joined-subclass>
</hibernate-mapping>

When I'm querying against Geek class - it is joined with Person and restriction "DELETED is null" is added. It's Okay. This is a way it is expected to work.

But when I perform removing Geek entity (for example with HQL or invoking getSession().remove(geek)) - corresponding entry in GEEK table is removed and sql-delete query is run against PERSON table

My question is: Can I inherit sql-delete from parent? I don't want any entries to be removed from my GEEK table, and I don't want additionally mark entries in GEEK table as deleted . Sure, I can set custom sql-delete query for Geek mapping as it is done for Person, but is there other solutions?