You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by George Chelidze <gc...@magtigsm.ge> on 2007/04/04 09:53:37 UTC
Oracle stored procedure with custom data types
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