-
Nov 23rd, 2005, 10:53 AM
#1
Spring Stored Proc with Oracle Object Types
Is there a way to express the following code with a Spring StoredProcedure Class and defineParameter? The Problem is that I need to do a setTypeMap and a setArray with a Oracle ARRAY to pass an Oracle ObjectType before the call to execute so that the parameter is recognized as the right OracleObjectType...
Thanks for reading,
Stefan.
----
conn = dataSource.getConnection();
Map map = conn.getTypeMap();
map.put(AbcVariant._SQL_NAME, AbcVariant.class);
map.put(TExtError._SQL_NAME, OracleExtError.class);
conn.setTypeMap(map);
CallableStatement cs = conn.prepareCall(query);
cs.registerOutParameter(1, Types.INTEGER);
ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor(ARRAY_TYPE_NAME, conn);
AbcVariant[] abcVariants = new AbcVariant[1];
abcVariants[0] = variant;
ARRAY array = new ARRAY(descriptor, conn, abcVariants);
cs.setArray(2, array);
cs.registerOutParameter(3, Types.ARRAY, "IO_EXT_ERROR");
cs.execute();
-
Nov 23rd, 2005, 11:58 AM
#2
Use the version of the execute method which takes a ParameterMapper instead of a Map. The ParameterMapper has a createMap method which gets passed a Connection where you can create the array with the code you specified. You populate and return the map from this method.
Bill
-
Nov 23rd, 2005, 02:18 PM
#3
-
Nov 24th, 2005, 02:43 AM
#4
Thanks
Thanks for your help. Now it is clear and working :-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules