ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From George Chelidze <gcheli...@magtigsm.ge>
Subject Oracle stored procedure with custom data types
Date Wed, 04 Apr 2007 07:53:37 GMT
Hello,

It's my first post to this list, so I'd like to say hello to all of you.

I have a procedure:

CREATE OR REPLACE PROCEDURE "S"."PREPROCPROC"(aInput in 
TPreprocInputMessageSet, aOutput out TPreprocOutputMessageSet) is
res TPreprocOutputMessageSet;
curi TPreprocInputMessage;
curo TPreprocOutputMessage;
begin
  res:=TPreprocOutputMessageSet();
  res.extend(aInput.Count);
 
  FOR i IN aInput.First .. aInput.Last
  LOOP
    curi:=aInput(i);
    curo:=TPreprocOutputMessage(null,null,null);
    curo.FieldA := curi.FieldA;
    curo.FieldB := curi.FieldB;
    curo.FieldC := null;
    res(i):=curo;
  END LOOP;
  aOutput:=res;
  res.delete;
end PreprocProc;

and the following custom types:
--
CREATE OR REPLACE TYPE TPREPROCINPUTMESSAGESET AS TABLE OF 
S.TPREPROCINPUTMESSAGE
GO
--
CREATE OR REPLACE TYPE TPREPROCOUTPUTMESSAGESET AS TABLE OF 
B1.TPREPROCOUTPUTMESSAGE
GO
--
CREATE OR REPLACE TYPE TPREPROCINPUTMESSAGE as object (
    FieldA varchar2(32),
    FieldB varchar2(32)
)
GO
--
CREATE OR REPLACE TYPE TPREPROCOUTPUTMESSAGE as object (
    FieldA varchar2(32),
    FieldB varchar2(32),
    FieldC varchar2(32)
)
GO
--
I have attached Main.java, TPreprocTypeHandler.java, SqlMapConfig.xml, 
SqlMapProcedure.xml files. The main problem  that I have is that in 
TPreprocTypeHandler.getResult(ResultGetter getter) method, 
getter.getObject().getArray() returns Object[] which contains instances 
of STRUCT not TPreprocInputMessage, so I have to map them to 
TPreprocInputMessage myself. Is it possible to tell ibatis to return 
instances of TPreprocInputMessage instead of instances of STRUCT?

Thanks in advance,

George


Mime
View raw message