|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Target(value={}) @Retention(value=RUNTIME) public @interface ConstructorResult
Used in conjunction with the SqlResultSetMapping
annotation to map
the SELECT clause of a SQL query to a constructor.
columns
element of the
ConstructorResult
annotation in the same order as that of the argument
list of the constructor. Any entities returned as constructor results will be
in either the new or detached state, depending on whether a primary key is
retrieved for the constructed object.
Example:
Query q = em.createNativeQuery( "SELECT c.id, c.name, COUNT(o) as orderCount, AVG(o.price) AS avgOrder " + "FROM Customer c, Orders o " + "WHERE o.cid = c.id " + "GROUP BY c.id, c.name", "CustomerDetailsResult" );
Required Element Summary | |
---|---|
ColumnResult[] |
columns
(Required) The mapping of columns in the SELECT list to the arguments of the intended constructor, in order. |
java.lang.Class |
targetClass
(Required) The class whose constructor is to be invoked. |
Element Detail |
---|
public abstract java.lang.Class targetClass
public abstract ColumnResult[] columns
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |