[ http://issues.apache.org/jira/browse/IBATIS-243?page=all ]
Sven Boden closed IBATIS-243:
-----------------------------
Resolution: Invalid
Assign To: Sven Boden
This is a support question.
The first response would be: how do you this in JDBC?
The second response would be that iBATIS doesn't support it, and will probably
not support it.
For a third response: have a look at
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:10271519764319
in which they don't advise to use object types in Java.
For a fourth and final response: O'Reilly has a book called "Java Programming
with Oracle JDBC" in which in Chapter 4 they completely explain what you want
to do (in JDBC) and where you will also see it's complexer than the
corresponding relational approach.
Sven
> 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
> Assignee: Sven Boden
> 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