Hello, i've got following mapping:
Parent of the Class hierarchy:
Code:
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
abstract class AbstractClass{
}
Children:
Code:
@DiscriminatorValue('A')
class A extends AbstractClass{
@OneToOne
@JoinColumn
C c;
}
@DiscriminatorValue('B')
class B extends A{
}
and the consumer:
Code:
class C{
@OneToOne(mappedBy = "c", targetEntity = A.class)
@JoinColumn
A a;
@OneToOne(mappedBy = "c", targetEntity = B.class)
@JoinColumn
B b;
}
if i try to retrieve all C's i get an exception and a Query with polymorphic "where" for attribute
a like bellow:
Code:
select * from C c
where c.a.dtype in (
'A', 'B'
)
and c.b.dtype in ('B');
How can i restrict the discriminator value (dtype) of
a to 'A' bypassing the implicit query polymorphism. I thought, that targetEntity=A.class could help but it didn't.
Need a help, thanks for advice!
Gena