开发者

Hibernate JPA Template fetch

Hiber开发者_Python百科nate JPA Template fetches list of objects from database. Can this be type casted to another class object list??

List<Class1> list1 = (List<Class1>) getJpaTemplate().findByNamedQuery("..someQuery..");

This is the code which i use now. Class1 relates to a table1 in database. Will I be able to fetch the records in table1 into another list<Class2> list2; which has all parameters as table1 and some extra parameters. If I will be able to fetch then will I be able to assign values to those extra parameters through namedQuery ??

Any help appreciated!!


Yes, you can. But before you have some more concrete questions, go read the following: Hibernate inheritance and JPA-QL reference, point 7.7, where they explain cat.class

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜