The
IlvSDOFeatureIterator class reads data from the result of an SQL query
to a relational Oracle Spatial layer and converts them into
IlvMapFeature
objects.
JViews Maps applications can handle Oracle Spatial
data using this class in a transparent manner.
The following example of Java™
code
performs a query, loading data from an Oracle Spatial layer named ROADS_SDOGEOM
.
It includes classes from the java.sql
package:
String query = "SELECT * FROM ROADS_SDOGEOM ORDER BY 1, 2, 4 ";
Statement statement = getConnection().createStatement();
ResultSet resultSet = statement.executeQuery(query);
IlvSDOFeatureIterator iterator = new IlvSDOFeatureIterator(resultSet);
The connection
variable is
a java.sql.Connection
object.
The query orders the result using the following three
criteria, which must be given in the order indicated:
GID (Geometric ID)
ESEQ (Element Sequence)
SEQ (Row Sequence)
Note
This ordering is necessary for the IlvSDOFeatureIterator
to
work correctly.
The
ResultSet
of any query
to an Oracle Spatial layer can be used to initialize an
IlvSDOFeatureIterator, but all the SDO columns must be in the
resultSet
(columns
defining the GID, ESEQ, ETYPE, SEQ, and the coordinates).
The features returned by this iterator have no attributes.
However, the GID of the Oracle Spatial geometry is used as the identifier
of each feature and this identifier can be used to retrieve additional
attributes from the database. See the method
getId.