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 francesco77 <f....@reply.it> on 2007/01/29 10:49:53 UTC

Passing Custom Object to Oracle Procedure

Hi to all,

I have created this ORACLE package :

CREATE OR REPLACE PACKAGE EXTRACT AS
    
    Type LIST is table of VARCHAR2(50);
    
    Type BEAN IS Record(
        CCF_START DATE,
        FUEL LIST LIST,
        FILENAME  VARCHAR2(50)
    );
    
    PROCEDURE receiveBeanFromJava(FORMBEAN BEAN);

END EXTRACT;
/

which contains a procedure that must receive an object of type BEAN (my
custom type).

My aim is to map the calling of this procedure in the SqlMapConfig file of
IBatis.
In my JAVA Project I have a bean class in this way:

package com.fiat.mida.model.extract;

import java.util.Date;
import java.util.List;

public class ParameterBean {
	
	private Date ccfStartDate;
	private String fileName;
	private List fuelType;
	
	public Date getCcfStartDate() {
		return ccfStartDate;
	}
	public void setCcfStartDate(Date ccfStartDate) {
		this.ccfStartDate = ccfStartDate;
	}
	public String getFileName() {
		return fileName;
	}
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	public List getFuelType() {
		return fuelType;
	}
	public void setFuelType(List fuelType) {
		this.fuelType = fuelType;
	}
	
}


In my DAO class I have this method:

public void insertFromVocBean(ParameterBean bean) {
    	Map messageKey = (Map) messageKeyOfThread.get();
    	
    	messageKey.put("i_ccfStart", bean.getCcfStartDate());
        messageKey.put("i_fuelType", bean.getFuelType());
        messageKey.put("i_fileName", bean.getFileName());
        
       
getSqlMapClientTemplate().queryForObject("DecodeUI.queryProcedureBean",messageKey);
    }


I want call the procedure EXTRACT.receiveBeanFromJava passing it an instance
of the object ParameterBean.

I have this SqlMap file which is not correct.

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
    "http://ibatis.apache.org/dtd/sql-map-2.dtd">

<sqlMap namespace="DecodeUI">

    <typeAlias alias="option" type="org.apache.struts.util.LabelValueBean"/>
    <typeAlias alias="bean"
type="com.fiat.mida.model.extract.ParameterBean"/>
   
    <procedure id="queryProcedureBean" parameterMap="bean">
  		{ call extract.receiveBeanFromJava(?) }
    </procedure>

</sqlMap>

When I compile I receive this error:

   [java] at
com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:123)
     [java] at
com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:84)
     [java] at
com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:102)
     [java] at
com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:72)
     [java] at
com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:51)
     [java] ... 52 more
     [java] Caused by: com.ibatis.common.xml.NodeletException: Error parsing
XML.  Cause: java.lang.RuntimeException: Error parsing XPath
'/sqlMap/procedure'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There
is no parameter map named DecodeUI.bean in this SqlMap.

How can I solve this very BIG problem ?

Can someone help me ?

thanks a lot

Francesco


-- 
View this message in context: http://www.nabble.com/Passing-Custom-Object-to-Oracle-Procedure-tf3134958.html#a8686575
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.