I have 3 classes:
Event
PublicEvent extends Event
PersonalEvent extends Event
my hibernate mapping file is somethings like bellow. i wanna add one filter for PersonalEvent
and before loading this object, i was enabled that's filter. but this is not working. my hibernate version is 4.3.11.Final
.
Event.hbm.xml
<hibernate-mapping>
<class name="org.calendar.Event">
...
<filter name="personalEventAuthorize" condition="person_ID = :personId" />
</class>
<joined-subclass name="org.calendar.PersonalEvent" extends="org.calendar.Event">
<key column="id" property-ref="id" />
...
<many-to-one name="person" column="person_ID" entity-name="org.person.Person" />
</joined-subclass>
<joined-subclass name="org.calendar.PublicEvent" extends="org.calendar.Event">
<key column="id" property-ref="id" />
...
</joined-subclass>
<filter-def name="personEventAuthorize">
<filter-param name="personId" type="integer" />
</filter-def>
</hibernate-mapping>
PersonalEventRepository
@Override
public PersonalEvent load(Long id) {
Filter filter = getSession().enableFilter("personEventAuthorize");
filter.setParameter("personId", getAuthenticatedPersonId());
return super.loadById(id);
}
hibernate generated SQL Query without my filter. what is my problem? why hibernate can not enabled filter for joined-subclass? thanks for all...