Hello,
As a workaround to a previous problem:
http://forum.hibernate.org/viewtopic.php?t=928578
I have created two normal classes instead of a hierarchy, and instead of discriminator-value, I use the "where" parameter in the <class> tag.
So, I have a class hierarchy like this:
Code:
Company -------< StupidPerson -------< Address
The StupidPerson class mapping begins like this:
<class name="StupidPerson" where="intellecutallychallenged='1'"
Now if I have a query which queries on a StupidPerson property
select comp.stupidperson.name from Company as comp
the intellectuallychallenged constraint DO appear in the SQL query.
But if I query on
select comp.stupidperson.address.streetname from Company as comp
The intellectuallychallenged constraint does not appear, even if I clearly(?)
wanted that constraint.
Is this in accordance with Hibernate semantics? If, so how can I guarantee the constraints on parent entities are used when querying on child entitites?