NPersistence Reference Guide
References name of a column in the SELECT clause of a SQL query - i.e., column alias, if applicable. Scalar result types can be included in the query result by specifying this annotation in the metadata.

Examples

CopyC#
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")]
          [EntityResult(ResultSetRef = "OrderResults", Name="OrderEntityResult", EntityClass=com.acme.Order.class)]
              [FieldResult(EntityRef = "OrderEntityResult", Name="id", Column="ordeR_ID")]
              [FieldResult(EntityRef = "OrderEntityResult", Name="quantity", Column="order_quantity")]
              [FieldResult(EntityRef = "OrderEntityResult", Name="item", Column="order_item")]
          [ColumnResult(ResultSetRef = "OrderResults", Name="item_name", Type = "String")]

Namespace: NPersistence
Assembly: NPersistence (in NPersistence.dll) Version: 2.0.0.0 (2.0.0.0)

Syntax

   
 C# 
public sealed class ColumnResult : Attribute

Members

         
 All Members  Constructors   Fields  
 Public

 Protected
 Instance

 Static 
 Declared

 Inherited
 XNA Framework Only 

 .NET Compact Framework Only 

 MemberDescription
ColumnResult()()()()
Initializes a new instance of the ColumnResult class
Name
(Required) The name of a column in the SELECT clause of a SQL query
ResultSetRef
(Required) Points to the SqlResultSetMapping this ColumnResult belongs to.
Type
(Required) The type of the scalar

Inheritance Hierarchy

System..::..Object
  System..::..Attribute
    NPersistence..::..ColumnResult

See Also