handling custom tables with custom objects returned from stored procedure
-------------------------------------------------------------------------
Key: IBATIS-243
URL: http://issues.apache.org/jira/browse/IBATIS-243
Project: iBatis for Java
Type: Improvement
Components: SQL Maps
Versions: 2.1.6
Environment: Windows XP ,
Oracle 10g
java 1.4
Reporter: Smaranda Tudor
Priority: Critical
Hi,
I have a problem with iBatis. Because some processings, which need to be done
in the database, I have to handle a strange returned datatype. Here is the
object structure (as sample, just a smaller than the original):
CREATE OR REPLACE
TYPE FACS_OBJ AS OBJECT
(
ID NUMBER(12),
NAME VARCHAR2(80),
CODE VARCHAR2(12),
)
and
CREATE OR REPLACE
type FACS_TABLE as table of FACS_OBJ;
As you can see there is about TABLE OF custom objects. The procedure has only
an out parameter of this kind of type. My mapping looks like the next sequence:
<parameterMap class="map" id="facs_ids">
<parameter property="outParameter" jdbcType="ARRAY"
typeName="FACS_TABLE"
mode="OUT"
typeHandler="ArrayTypeHandlerCallback" />
</parameterMap>
<procedure id="testSpecialType" parameterMap="facs_ids" >
<![CDATA[
{ call PAC_CR_SECURITY.testSpecialType(?) }
]]>
</procedure>
My handler does nothing special than override the getResult function:
public Object getResult(ResultGetter rg) throws SQLException {
if (rg.wasNull()) {
return null;
}
Array arr = rg.getArray();
if (arr == null) {
return default_result;
}
ResultSet rs = arr.getResultSet();
if (rs == null) {
return default_result;
}
List results = new ArrayList();
while (rs.next()) {
Object result = rs.getObject(2);
if (log.isDebugEnabled()) {
log.debug("result classname: " + result.getClass().getName());
}
results.add((Struct)result);
}
return results;
}
My problem is next : the type of inner objects is not transparent to the java
application. The struct type is quite difficult to process. How could I handle
the returned type in this situation. This object is a simple one because it
could contain another lists as members.
Thanks
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira