JPA:如果在@SqlResultSetMapping 中定义了类、实体和列,那么返回对象的顺序是什么?
@SqlResultSetMapping(
name="CustomerDetailsResult",
classes={
@ConstructorResult(
targetClass=com.example.Customer.class,
columns={
@ColumnResult(name="id"),
@ColumnResult(name="name"),
}
)
},
entities={
@EntityResult(entityClass=com.example.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")}
)
结果行是 Object[]{customer, order, scalar_value} 或 Object[]{order, scalar_value, customer} 等。