开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜