Hello,
We recently ran into a situation where it would be nice to add a subclass of an entity to the model and query an entity based on what type an attribute is. The entities might look something like this:
Code:
@Entity class Root{
@Id Long id;
@ManyToOne Parent parent;
}
@Entity @Inheritance( strategy= SINGLE_TABLE) class Parent{
@Id Long id;
}
@Entity class Child extends Parent{
@Id Long id;
@Basic String additionalAttribute;
}
Now I would like to select all Root instances where Root.parent is a Parent and not a Child. JPQL does not seem to support this, though a strongly typed object query language would seem to imply this is possible. If this were Java code it would be something like !(root.parent instanceof Child).
--
Tim