在Hibernate中使用数组类型创建类型化查询

时间:2018-09-07 08:57:21

标签: java hibernate types

在Hibernate it is possible to create a typed query中返回实体,值或对象数组:

createQuery("from Cat where id=:ID", Cat.class)
createQuery("select id from Cat where name=:NAME", Long.class)
createQuery("select id, name from Cat where breed=:BREED", Object[].class)

是否可以返回键入到更特定数组的查询,例如Long []。class,如下所示?

createQuery("select id, age from Cat where name=:NAME", Long[].class)

0 个答案:

没有答案