|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
javax.persistence Annotation Type SqlResultSetMapping
Implements:
Annotation
@Target(value=TYPE)@Retention(value=RUNTIME)
此注释用于指定本机 SQL 查询结果的映射。
示例: 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")} )
since |
|
This annotation is used to specify the mapping of the result of a native SQL query.
Example: 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")} )
- Since:
- Java Persistence 1.0
Required Element Summary | |
---|---|
String |
name
The name given to the result set mapping, and used to refer to it in the methods of the Query API. |
Optional Element Summary | |
---|---|
ColumnResult[] |
columns
Specifies the result set mapping to scalar values. |
EntityResult[] |
entities
Specifies the result set mapping to entities. |
Element Detail |
---|
abstract public String
name()
为结果集映射指定的名称,将在 Query
API 的方法中引用。
英文文档:
name
public abstract String name
- The name given to the result set mapping, and used to refer
to it in the methods of the
Query
API.
abstract public EntityResult[]
entities()
指定映射到实体的结果集。
英文文档:
entities
public abstract EntityResult[] entities
- Specifies the result set mapping to entities.
- Default:
- {}
abstract public ColumnResult[]
columns()
指定映射到标量值的结果集。
英文文档:
columns
public abstract ColumnResult[] columns
- Specifies the result set mapping to scalar values.
- Default:
- {}
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!