/** Convience method for STRUCT construction. */ protected final STRUCT toSTRUCT(Datum attributes[], String dataType) throws SQLException { if (dataType.startsWith("*.")) { dataType = "DRA." + dataType.substring(2); // TODO here } StructDescriptor descriptor = StructDescriptor.createDescriptor(dataType, connection); return new STRUCT(descriptor, connection, attributes); }
/** Convenience method for STRUCT construction. */ public static STRUCT toSTRUCT(Datum[] attributes, String dataType, OracleConnection connection) throws SQLException { //TODO: fix this to be more generic if (dataType.startsWith("*.")) { dataType = "DRA." + dataType.substring(2); } StructDescriptor descriptor = StructDescriptor.createDescriptor(dataType, connection); return new STRUCT(descriptor, connection, attributes); }
/** Convience method for STRUCT construction. */ protected final STRUCT toSTRUCT( Datum attributes[], String dataType ) throws SQLException { if( dataType.startsWith("*.")){ dataType = "DRA."+dataType.substring(2);//TODO here } StructDescriptor descriptor = StructDescriptor.createDescriptor( dataType, connection ); return new STRUCT( descriptor, connection, attributes ); }
public Struct createStruct(SDOGeometry geom, Connection conn) throws SQLException { OracleConnection oracleConnection = null; try { oracleConnection = connectionFinder.find(conn); } catch (FinderException e) { throw new HibernateException("Problem finding Oracle Connection", e); } StructDescriptor structDescriptor = StructDescriptor .createDescriptor(SDOGeometryType.SQL_TYPE_NAME, oracleConnection); Object[] attributes = new Datum[5]; attributes[0] = new NUMBER(geom.getGType().intValue()); if (geom.getSRID() > 0) { attributes[1] = new NUMBER(geom.getSRID()); } else { attributes[1] = null; } attributes[3] = createElemInfoArray(geom.getInfo(), oracleConnection); attributes[4] = createOrdinatesArray(geom.getOrdinates(), oracleConnection); return new STRUCT(structDescriptor, conn, attributes); }