I am using Hibernate version: 3b4
I ran into the following issue when using filters on a hibernate mapping with inheritance.
When having a baseclass "A" and a subclass "A1" as a "joined-subclass", enabling a filter in the baseclass does not seem to have any effect when querying for objects of the subclass A1.
My mapping document looks like this:
Code:
<hibernate-mapping>
<class name="A" table="A">
...
<joined-subclass name="A1" table="A1">
...
</joined-subclass>
<filter name="hideTemporaryObjects" condition="status=1" />
</class>
</hibernate-mapping>
This is the code to retrieve the objects:
Code:
session.enableFilter("hideTemporaryObjects");
// this query returns the filtered dataset as expected
Query query = session.createQuery("from A");
// this query will return an unfiltered dataset
query = session.createQuery("from A1");
I expected that enabling the filter on class A will consequently filter all sublasses.
Declaring the filter under the <joined-sublass> element is not possible either because it is not allowed by the DTD.
But how can I enable the filter for my subclasses?
Thanks in advance,
Bernado.
[/code]