Announcement Announcement Module
Collapse
No announcement yet.
Oracle XMLType and Hibenate with Spring framework Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Oracle XMLType and Hibenate with Spring framework

    We are facing one issue while using Hibernate with Oracle XMLType Data type.



    Development Environment:

    Weblogic 8.1 SP4,

    Oracle 10g

    Hibernate 3.0

    Spring 2.0.4



    Requirement: To insert/retrieve XML into XMLType column (Oracle 10g) through Hibernate.



    We have got sample implementation of Oracle XMLType for Weblogic as a Container on Hibernate.org (http://www.hibernate.org/369.html)

    While implementing code mentioned in the link, we are getting ClassCasteException:weblogic.jdbc.wrapper.ResultSe t_oracle_jdbc_driver_OracleResultSetImpl



    In implementation of public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException

    We are getting OracleResultSet which is wrapped by weblogic.jdbc.wrapper.ResultSet. Following is code snippet.



    public Object nullSafeGet( ResultSet rs, String [ ] names, Object arg2 ) throws HibernateException, SQLException {
    OracleResultSet ors = null;

    if ( rs instanceof weblogic.jdbc.wrapper.ResultSet ) {

    ors = (OracleResultSet) getNativeResultSet ( rs ); //getting ClassCastException

    } else if ( rs instanceof OracleResultSet ) {

    ors = (OracleResultSet) rs;

    } else {

    throw new UnsupportedOperationException (

    "Only direct support for Weblogic and Oracle drivers. Please check your pool driver." );

    }

    OPAQUE op = ors.getOPAQUE(names[0]);

    oracle.xdb.XMLType xt= oracle.xdb.XMLType.createXML(op);

    org.w3c.dom.Document doc = (org.w3c.dom.Document) xt.getDocument();

    return (org.w3c.dom.Document) doc;

    }


    getNativeResultSet () is implementation method of org.springframework.jdbc.support.nativejdbc.Weblog icNativeJdbcExtracor



    We are not finding proper solution for the problem. I have also put the question on http://forum.hibernate.org but did not get solution.



    It would be great help if you can help us in resolving the issue.





    Thanks

    Chintan
Working...
X