How to filter a particular class when i have a inheritance?
I have this code :
class A {
String name
}
cl开发者_如何学JAVAass B extends A{
}
class C extends A{
}
class D{
A a
}
D d = new D(); d.a = new B()
D d2 = new D(); d.a = new C()
My query :
D.createCriteria().list(...){
A{
eq "a","test"
}
}
But in my result I would have only the element matching with B class not C class.
Is it possible ?
Thanks a lot
I find this :
A{
eq "class", B.name
}
Thank you
精彩评论