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 -> Re: Mapping SDO_GEOMETRY to Java Object

Re: Mapping SDO_GEOMETRY to Java Object

From: <martial.tola_at_libertysurf.fr>
Date: Wed, 15 Mar 2000 15:31:57 +0100
Message-ID: <38CF9EDD.5A8072A9@libertysurf.fr>


I think in your test program there is :

	Dictionary map = (Dictionary)conn.getTypeMap();
    	map.put("SDO_POINT_TYPE", Class.forName("SDO_POINT_TYPE_OBJECT"));
    	map.put("SDO_GEOMETRY", Class.forName("SDO_GEOMETRY_OBJECT"));

so try with this :

	Dictionary map = (Dictionary)conn.getTypeMap();
    	map.put("MDSYS.SDO_POINT_TYPE",
Class.forName("SDO_POINT_TYPE_OBJECT"));
    	map.put("MDSYS.SDO_GEOMETRY",

Class.forName("SDO_GEOMETRY_OBJECT"));

it works with my program !

varnera_at_my-deja.com a écrit :
>
> 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 Wed Mar 15 2000 - 08:31:57 CST

Original text of this message

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