java.sql
Annotation Type ResultColumn


@Documented
@Retention(value=RUNTIME)
@Target(value=FIELD)
public @interface ResultColumn

Annotation that allows for the field of a data class for a given DataSet to be mapped to a column of a SQL result set that is returned by invoking a method decorated by a Select annotation.

Overview

The ResultColumn annotation is used to decorate a field within a data class, allowing the application developer to specify an alternative name for the column returned in a SQL result set.

The ResultColumn annotation can also be used to indicate that a data class field is to be used to uniquely identify a row when a DataSet is used in a disconnected mode.

In the example below, the ResultColumn annotation is used to specify that the Mammal.weight field corresponds to the column kilos in the result set that is returned by invoking the method getAllMammals.

 public class Mammal {
     public String name;
     public String description;
     public @ResultColumn("kilos") int weight;
 }
 

 // Obtain an instance of the Query interface, Queries
 Queries myQueries = con.createQueryObject(Queries.class)
 DataSet<Mammal> rows = myQueries.getAllMammals();
 for( Mammal row :rows) {
     System.out.print("name: " + row.name + ", weight: " + row.weight);
 }
 

Since:
1.6

Optional Element Summary
 String name
          The SQL column to map to.
 boolean uniqueIdentifier
          Annotation element indicating whether this column is used to uniquely identify a row within a disconnected DataSet.
 String value
          The SQL column to map to.
 

name

public abstract String name
The SQL column to map to.

Note: If the name and the value annotation element are specified at the same time, a SQLRuntimeException will be thrown.

Returns:
a String specifying the column's name.
Since:
1.6
Default:
""

uniqueIdentifier

public abstract boolean uniqueIdentifier
Annotation element indicating whether this column is used to uniquely identify a row within a disconnected DataSet. This element is ignored when the DataSet is used in a connected mode.

Returns:
a true if the field is used to uniquely identify the row; false otherwise
Since:
1.6
Default:
false

value

public abstract String value
The SQL column to map to.

Note: If the name and the value annotation element are specified at the same time, a SQLRuntimeException will be thrown.

Returns:
a String specifying the column's name.
Since:
1.6
Default:
""