How do I do:
aaaa where(a.class = B and a .specific-property-of-b = “y”) or (a.class = C and a.specific-property-of-c = “z”)
Is it possible to let hibernate Understand that when it is an instance of a certain class, it can access its specific properties, or it is impossible to do similar things, I have to do this:
aaaaa where a.id in(select b. id from bb where b.specific-property-of-b = “y”)
or a.id in (select c.id from C c, where c.specific-property-of-c = “z” )
Thank you
select a from A a
where (a.class = B and a.specificPropertyOfB ='y')
or (a.class = C and a.specificPropertyOfC ='z')
According to my experience, the only thing that does not work is that you define two persistent fields with the same name in the two subclasses.
I have a class A and a class B and a class C. They have different attributes.
How do I do:
aaaa where(a.class = B and a.specific- property-of-b = “y”) or (a.class = C and a.specific-property-of-c = “z”)
Is it possible for hibernate to understand, when When it is an instance of a certain class, it can access its specific properties, or it is impossible to do similar things, I have to do this:
aaaaa where a.id in(select b.id from bb where b.specific- property-of-b = “y”)
or a.id in (select c.id from C c, where c.specific-property-of-c = “z”)
Thank you
You did it as you suggested:
select a from A a < br />where (a.class = B and a.specificPropertyOfB ='y')
or (a.class = C and a.specificPropertyOfC ='z')
According to my experience , The only thing that does not work is that you define two persistent fields with the same name in the two subclasses.