ERROR - Internal Error: Image is a collection image, expecting ADT [message #465066] |
Mon, 12 July 2010 07:45 |
Roger22
Messages: 98 Registered: April 2009 Location: Brasov, ROMANIA
|
Member |
|
|
Hello,
I am getting in log this error message.
I have the following code:
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Struct;
import java.util.Arrays;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
import oracle.jdbc.driver.OracleTypes;
import org.apache.log4j.Logger;
import ro.romtelecom.serviceorder.www.SOListOfMdf.ListOfMdfTab;
public class ApelSO {
private boolean showlog = false;
private final String versiune = "WS SOListOfMdf 1.0 ; ";
final static Logger log = Logger.getLogger(ApelSO.class);
public static ListOfMdfTab SO_execute(java.lang.String puid_prodso, java.lang.String plcom_old) {
long start_op = System.currentTimeMillis();
ListOfMdfTab rezultat=null;
CallableStatement cs=null;
Connection conn = null;
try {
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
if (envCtx == null)
throw new Exception("No Environment Context");
DataSource ds = (DataSource) envCtx
.lookup("jdbc/SODB_SOListOfMdf");
conn = ds.getConnection();
cs = conn.prepareCall("{ ? = call OS_WORK_REQUEST_UTILS.SO_LIST_OF_MDF(?,?)}");
cs.setString(2,puid_prodso);
cs.setString(3,plcom_old);
cs.registerOutParameter(1, OracleTypes.ARRAY,"INFO.TLISTOFMDFTBL");
cs.execute();
rezultat=new ListOfMdfTab();
java.sql.Struct object1 = (java.sql.Struct) cs.getObject(1);
Object[] object1Values = object1.getAttributes();
rezultat.setCli((String)object1Values[0]);
System.out.println((String)object1Values[0]);
rezultat.setLcom_old((String)object1Values[1]);
rezultat.setSegmenttype((String)object1Values[2]);
rezultat.setNr((String)object1Values[3]);
rezultat.setStart_county_code((String)object1Values[4]);
rezultat.setStart_city_node((String)object1Values[5]);
rezultat.setStart_node_type((String)object1Values[6]);
rezultat.setStart_node_code((String)object1Values[7]);
rezultat.setStart_conectat_vdsl((String)object1Values[8]);
rezultat.setStart_conectat_dslam((String)object1Values[9]);
rezultat.setStop_city_node((String)object1Values[10]);
rezultat.setStop_node_type((String)object1Values[11]);
rezultat.setStop_node_code((String)object1Values[12]);
rezultat.setStop_conectat_vdsl((String)object1Values[13]);
rezultat.setStop_conectat_dslam((String)object1Values[14]);
rezultat.setGroup1((String)object1Values[15]);
rezultat.setPair((String)object1Values[16]);
rezultat.setGroup1((String)object1Values[17]);
rezultat.setSid((String)object1Values[18]);
cs.close();
cs = null;
conn.close();
conn = null;
long stop_op = System.currentTimeMillis() - start_op;
} catch (SQLException er) {
log.error(er.getMessage());
log.error("SQLEX_ERR: " + er.getMessage());
try {
if (conn != null) {
conn.rollback();
}
} catch (SQLException er1) {
log.error(er1.getMessage());
}
long stop_op = System.currentTimeMillis() - start_op;
} catch (Exception er) {
log.error(":" + er.getMessage());
long stop_op = System.currentTimeMillis() - start_op;
} finally {
if (cs != null) {
try {
cs.close();
} catch (SQLException er) {
log.error(":" + er.getMessage());
}
cs = null;
}
if (conn != null) {
try {
conn.close();
} catch (SQLException er) {
log.error( er.getMessage());
}
conn = null;
}
}
return rezultat;
}
}
The problem is that i got the error: Image is a collection image, expecting ADT and i don't know why.
TLISTOFMDFTBL is created via "create or replace type TLISTOFMDFTBL is table of ....." , and if i issue:
SQL> desc TLISTOFMDFTBL
TLISTOFMDFTBL TABLE OF TLISTOFMDFREC
Name Null? Type
----------------------------------------- -------- -------------------
CLI VARCHAR2(80)
LCOM_OLD VARCHAR2(1)
SEGMENTTYPE VARCHAR2(16)
NR VARCHAR2(18)
START_COUNTY_CODE VARCHAR2(4)
START_CITY_NODE VARCHAR2(10)
START_NODE_TYPE VARCHAR2(16)
START_NODE_CODE VARCHAR2(32)
START_CONECTAT_VDSL VARCHAR2(1)
START_CONECTAT_DSLAM VARCHAR2(1)
STOP_COUNTY_CODE VARCHAR2(4)
STOP_CITY_NODE VARCHAR2(10)
STOP_NODE_TYPE VARCHAR2(16)
STOP_NODE_CODE VARCHAR2(32)
STOP_CONECTAT_VDSL VARCHAR2(1)
STOP_CONECTAT_DSLAM VARCHAR2(1)
GROUP1 VARCHAR2(32)
PAIR VARCHAR2(18)
SID VARCHAR2(18)
So this type is a collection type.
ListOfMdfTab is the class with getters, setters for all this type fields. So , for test, i wanna output object1Values[0] and object1Values[1] (within that type), not all of them.
What i'm doing wrong? I really don't understand.. Can you help me?
Thanks!
[Updated on: Mon, 12 July 2010 07:56] Report message to a moderator
|
|
|
|