在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)