我真的很困惑,如何做列的结果集定义的工作? 我是什么映射,当我使用的,而不是实体列? 看下面这个例子...
Query q = em.createNativeQuery(
"SELECT o.id AS order_id, " +
"o.quantity AS order_quantity, " +
"o.item AS order_item, " +
"i.name AS item_name, " +
"FROM Order o, Item i " +
"WHERE (order_quantity > 25) AND (order_item = i.id)",
"OrderResults");
@SqlResultSetMapping(name="OrderResults",
entities={
@EntityResult(entityClass=com.acme.Order.class, fields={
@FieldResult(name="id", column="order_id"),
@FieldResult(name="quantity", column="order_quantity"),
@FieldResult(name="item", column="order_item")})},
columns={
@ColumnResult(name="item_name")}
)
我能明白他想在这里做,实体结果将结果集,他希望,字段将尝试和字段映射到别名名称,到底是什么结果列在做什么? 它看起来并不像它映射到任何东西。