Hello,
here's my problem :
I have a
MappedSuperClass A, with two Entity
subclasses B and C, mapped on separate tables.
A declares a foreign key property, say 'children', which is properly implemented in B.
But C, for usecase specific and performance reasons, never has children, and should not have it in its db mapping :
Code:
A --> declares getChildren()
/ \
| C.getChildren(): returns empty set
|
B.getChildren() : mapped as foreign key in DB
Now, I want to express a query (in my case in HQL), where I say :
Code:
select a from A where 'foo' in children
And this fails, since C does not have any DB mapping for 'children' :
org.hibernate.QueryException: could not resolve property: children
How can I implement this ?
Is there any way to override a property and mark it as being a constant or null in one of the subclasses, so the mapping doesn't try to resolve it ?
Or do you think there's a flaw in my object model design if I need to do that ?
thank you