| public interface class java.sql ResultColumn
|
Java SE 6 |
DataSet to be mapped to a column
of a SQL result set that is returned by invoking a method
decorated by a Select annotation.
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. There must be at least one column specified to
uniquely identify a row for a disconnected DataSet otherwise
a SQLRuntimeException will be thrown.
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 Elements | |||||
|---|---|---|---|---|---|
| abstract public String | name() The SQL column to map to. Note: If the
| ||||
| abstract public 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.
| ||||
| abstract public String | value() The SQL column to map to. Note: If the
| ||||
| About DocWeb · Bundles · Export · Export All | Top 10 · Statistics · Login |
| About Sun · Contact · Privacy · Terms of Use · Trademarks | Java SE 6 · Copyright © 1994-2009 Sun Microsystems, Inc.All rights reserved. Use is subject to license terms |
![]() |
![]() |
|