I would be happy to use a different method if it will be easier,but I
can not access that link. I am told it is only available to
ParnerNetwork Program Partners.
Thanks
Guy Rouillier wrote:
I've never had the need to use Oracle struct datatype, but I just used
Google to find this:
http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/objects/ObjectTypes.html
The example is doing things differently than your code is. Perhaps
following the example will produce useful results.
This appears to be a JDBC issue rather than an iBATIS issue.
On 4/26/2010 2:27 PM, Brian May wrote:
I am trying to map an Oracle type to a Java object using ibatis, but I
am confounded by a ClassCastException. It seems like I am using the
wrong version of the oracle.sql.STRUCT object, but I have no idea how to
find out what version of I should be using. I currently have Ibatis
2.3.4, ojdbc6, and Spring 3.0.2. Any help would be appreciated.
SqlMap:
<resultMap class="Object" id="attributeMap">
<result property="attribute" javaType="Object" jdbcType="ARRAY"
typeHandler="AttributeHandlerCallback"/>
</resultMap>
<select id="attribute" resultMap="attributeMap">
select
attribute_obj(0)
from dual
</select>
Dao:
public void getAttribute() {
queryForObject("attribute");
)
TypeHandler:
@Override
public Object getResult(final ResultGetter resultGetter) throws
SQLException {
Attribute atttribute = new attribute();
try {
final Object object = resultGetter.getObject();
System.out.println(object.getClass());
final STRUCT array = (oracle.sql.STRUCT)resultGetter.getObject();
} catch (SQLException e) {
// TODO: handle exception
e.printStackTrace();
}
return attribute
}
Caused by: java.lang.ClassCastException: oracle.sql.STRUCT cannot be
cast to oracle.sql.STRUCT
at
gov.noaa.ncdc.cdo.services.dao.ibatis.typehandlers.AttributeHandlerCallback.getResult(DataHandlerCallback.java:30)
at
com.ibatis.sqlmap.engine.type.CustomTypeHandler.getResult(CustomTypeHandler.java:58)
at
com.ibatis.sqlmap.engine.mapping.result.ResultMap.getPrimitiveResultMappingValue(ResultMap.java:617)
at
com.ibatis.sqlmap.engine.mapping.result.ResultMap.getResults(ResultMap.java:345)
at
com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:384)
at
com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:300)
at
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:189)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189)
... 46 more
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org