I have an entity named father and son1 and son2 who are mapped as collections inside father
Lets say father has a,b,开发者_运维百科c properties son1 has a,d and son 2 has b,e and I have a bean which contains a,b,d,e called MyBean in one query.
Can I use it in a simple query using addEntity(MyBean.class) where my MyBean is not an hibernate entity (POJO)?
the POJO is as simple as it gets without annotations
class POJO {
Object a,b,d,e;
//get and set's and empty c'tor etc
}
use the new keyword and create the object in your search query
this only works for jpql
Can I use it in a simple query using addEntity(MyBean.class) where my MyBean is not an hibernate entity (POJO)?
I don't believe so. I believe that hibernate must know about all classes it persists via mappings.
精彩评论