Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Mapping SDO_GEOMETRY to Java Object

Mapping SDO_GEOMETRY to Java Object

From: <varnera_at_my-deja.com>
Date: Tue, 14 Mar 2000 14:08:11 GMT
Message-ID: <8alh48$ntg$1@nnrp1.deja.com>


Hi,
I am having difficulties integrating Oracle Spatial with JDBC. I want to map the SDO_GEOMETRY object to a Java Object. Here's the object I want to map it to ... public class SDO_GEOMETRY_OBJECT implements SQLData { private String sql_type;
public BigDecimal gType;
public BigDecimal SRID;
public SDO_POINT_TYPE_OBJECT SDO_POINT_TYPE; public java.sql.Array SDO_ELEM_INFO;
public java.sql.Array SDO_ORDINATE_ARRAY; // the rest of the class
}

And here's the code to read it from the database public void readSQL(SQLInput stream, String typeName) throws SQLException {
sql_type = typeName;
gType = stream.readBigDecimal();
SRID = stream.readBigDecimal();

SDO_POINT_TYPE = (SDO_POINT_TYPE_OBJECT) stream.readObject();
SDO_ELEM_INFO = stream.readArray();
SDO_ORDINATE_ARRAY = stream.readArray();

}

My test program is throwing
java.lang.ClassCastException: oracle.sql.STRUCT when I try to cast an object in the ResultSet to SDO_GEOMETRY_OBJECT. Any ideas? Anyone have any sample code for mapping SDO_GEOMETRY to a Java object?
Much Appreciated,
Drew

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Tue Mar 14 2000 - 08:08:11 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US