Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 46584 invoked from network); 27 Dec 2007 03:30:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Dec 2007 03:30:40 -0000 Received: (qmail 38495 invoked by uid 500); 27 Dec 2007 03:30:27 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 38482 invoked by uid 500); 27 Dec 2007 03:30:27 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 38471 invoked by uid 99); 27 Dec 2007 03:30:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Dec 2007 19:30:27 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,NORMAL_HTTP_TO_IP,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jeffgbutler@gmail.com designates 209.85.146.176 as permitted sender) Received: from [209.85.146.176] (HELO wa-out-1112.google.com) (209.85.146.176) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Dec 2007 03:30:02 +0000 Received: by wa-out-1112.google.com with SMTP id j5so5105415wah.24 for ; Wed, 26 Dec 2007 19:30:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=AHQhI+PzgfmR7WoPBWA2Dx9/Us3YkWe3Cju+EueDYP8=; b=c72am3k1Y5uRg9UwE4kLnMHg+jWw699OG0HjQH4WZIjhjBQaJ7GIT4B8OcooWh4dc4Co0pK4zLTGro8Lt4nACH2YsRWK3QnsjRqUPsz87vvgFelrv4TCPXe2P8ML/Jx2MzvxbM+3yF8y6njpjd5GBlBVAgUcMDUB6j1+IQO2ye8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=PJE++e3jKhanEth3Zkf4aO/cDkkne43Q83TTACn1NtJIjjlhAXnx0u1/6UCsB9h2O7F4o2pHuwJbJBTrw0ogwHPpWjppO+WoMJCNoZ4Ay6t2ZKutkNghfjJpNJxhaz0Tc5+YxmdcMXSKt5FM/oov+/e57Epq9bZ4c5EB6E7Qxfc= Received: by 10.114.66.2 with SMTP id o2mr5753544waa.111.1198726206407; Wed, 26 Dec 2007 19:30:06 -0800 (PST) Received: by 10.115.111.12 with HTTP; Wed, 26 Dec 2007 19:30:06 -0800 (PST) Message-ID: Date: Wed, 26 Dec 2007 21:30:06 -0600 From: "Jeff Butler" To: user-java@ibatis.apache.org Subject: Re: Exception "XMLType mapping only supported for Oracle RDBMS" In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_19861_17122284.1198726206401" References: X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_19861_17122284.1198726206401 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Here's how to get the real resultset from a the proxied class: *public* Object getResult(ResultGetter getter) *throws* SQLException { ResultSet rs = getter.getResultSet(); * if* (Proxy.*isProxyClass*(rs.getClass())) { InvocationHandler ih = Proxy.*getInvocationHandler*(rs); * if* (ih *instanceof* ResultSetLogProxy) { ResultSet realResultSet = ((ResultSetLogProxy) ih).getRs(); // do something here... } } } It's ugly - but it works. Jeff Butler On Dec 26, 2007 11:37 AM, wrote: > > Jeff, > > I did read your posting at * > http://www.mail-archive.com/user-java@ibatis.apache.org/msg06898.html* > * * already before sending this question. I could not understand how/where > do I modify the code to consider proxy class. > > My getOpaqueValue() displays *ResultSet class is: $Proxy2,* not > ResultSetLogProxy. > > The program DOES WORK if I turn off logging. > > I tried something like this: > > public Object getResult(ResultGetter getter) throws SQLException { > // if (getter.getResultSet() instanceof OracleResultSet) { > OPAQUE opaqueValue = getOpaqueValue(getter); > if (opaqueValue != null) { > XMLType xmlResult = XMLType.createXML(opaqueValue); > return xmlResult.getDOM(); > } else { > return null; > } > // } else { > // throw new UnsupportedOperationException("XMLType mapping > only supported for Oracle RDBMS"); > // } > } > > > private OPAQUE getOpaqueValue(ResultGetter getter) throws SQLException > { > > java.sql.ResultSet rs = getter.getResultSet(); > System.out.println("ResultSet class is: " + rs.getClass()); > // ResultSetLogProxy rsProx = (ResultSetLogProxy)rs; > OracleResultSet ors = > (OracleResultSet)ResultSetLogProxy.newInstance(rs); //--- *THROWS > ClassCastException* > OPAQUE op = null; > if (getter.getColumnName() != null) { > op = ors.getOPAQUE(getter.getColumnName()); > } else { > op = ors.getOPAQUE(getter.getColumnIndex()); > } > return op; > } > > > Thanks > > > > > *"Jeff Butler" * > > 12/26/2007 12:24 PM Please respond to > user-java@ibatis.apache.org > > To > user-java@ibatis.apache.org > cc > Subject > Re: Exception "XMLType mapping only supported for Oracle RDBMS" > > > > > The code in the wiki article does not take into account the fact that > iBATIS logging changes the normal classes to proxy classes. First thing to > do is turn off logging to see it will work. Second thing, the code must be > modified to account for the proxy class if logging is enabled (add another > instanceof check for the proxy class, then unwind the embedded "real" > class). > > See here for more information: > > *http://www.mail-archive.com/user-java@ibatis.apache.org/msg06898.html* > > Jeff Butler > > > > On Dec 26, 2007 10:26 AM, <*Jasmin_Mehta@nexweb.org*> > wrote: > > I am using code as directed in this url: > * > **http://opensource.atlassian.com/confluence/oss/display/IBATIS/XMLTypeHandlerCallback.java > * > > It throw UnsupportedOperationException("XMLType mapping only supported for > Oracle RDBMS"); > > I have logger set to DEBUG mode. > > I tried displaying class from ResultSet like : > > java.sql.ResultSet rs = getter.getResultSet(); > System.out.println("ResultSet class is: " + rs.getClass()); > > The cosole displays > > [20 Dec 2007 15:15:05] DEBUG [PreparedStatement] {pstm-100001} Executing > Statement: SELECT OTM, SEQUENCE, MESSAGETYPE, MESSAGEID, STATUS, > PROCESSED_TIME, CREATED FROM OTM_XML > [20 Dec 2007 15:15:05] DEBUG [PreparedStatement] {pstm-100001} Parameters: > [] > [20 Dec 2007 15:15:05] DEBUG [PreparedStatement] {pstm-100001} Types: [] > [20 Dec 2007 15:15:05] DEBUG [ResultSet] {rset-100002} ResultSet * > ResultSet class is: class $Proxy2 * > > I am using JDeveloper *10.1.3.1* > > What should I change in my code to make it working? > > Thanks > > * > ****************************************************************************** > * > ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION > Our domain name is changing. Please take note of the sender's > e-Mail address and make changes to your personal address list, > if needed. Both domains will continue to work, only for a limited > time. > > ****************************************************************************** > This email and any files transmitted with it are intended solely for > the use of the individual or agency to whom they are addressed. > If you have received this email in error please notify the Navy > Exchange Service Command e-mail administrator. This footnote > also confirms that this email message has been scanned for the > presence of computer viruses. > > Thank You! * > > ****************************************************************************** > * > > ------=_Part_19861_17122284.1198726206401 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
Here's how to get the real resultset from a the proxied class:
 

public Object getResult(ResultGetter getter) throws SQLException {
  ResultSet rs = getter.getResultSet();
  if (Proxy.isProxyClass(rs.getClass())) {
    InvocationHandler ih = Proxy. getInvocationHandler(rs);
    if (ih instanceof ResultSetLogProxy) {
      ResultSet realResultSet = ((ResultSetLogProxy) ih).getRs();
      // do something here...
    }
  }
}

It's ugly - but it works.

Jeff Butler
On Dec 26, 2007 11:37 AM, <Jasmin_Mehta@nexweb.org> wrote:

Jeff,

I did read your posting at http://www.mail-archive.com/user-java@ibatis.apache.org/msg06898.html  already before sending this question. I could not understand how/where do I modify the code to consider proxy class.

My getOpaqueValue() displays ResultSet class is: $Proxy2, not ResultSetLogProxy.

The program DOES WORK if I turn off logging.

I tried something like this:

  public Object getResult(ResultGetter getter) throws SQLException {
    //    if (getter.getResultSet() instanceof OracleResultSet) {
            OPAQUE opaqueValue = getOpaqueValue(getter);
            if (opaqueValue != null) {
                XMLType xmlResult = XMLType.createXML (opaqueValue);
                return xmlResult.getDOM();
            } else {
                return null;
            }
     //   } else {
      //      throw new UnsupportedOperationException("XMLType mapping only supported for Oracle RDBMS");
      //  }
    }


    private OPAQUE getOpaqueValue(ResultGetter getter) throws SQLException {

         
          java.sql.ResultSet rs = getter.getResultSet();
          System.out.println("ResultSet class is: " + rs.getClass());
   //       ResultSetLogProxy rsProx =  (ResultSetLogProxy)rs;
          OracleResultSet ors = (OracleResultSet)ResultSetLogProxy.newInstance(rs);         //--- THROWS ClassCastException
          OPAQUE op = null;
          if (getter.getColumnName() != null) {
              op = ors.getOPAQUE(getter.getColumnName());
          } else {
              op = ors.getOPAQUE(getter.getColumnIndex());
          }
          return op;
      }


Thanks




"Jeff Butler" <jeffgbutler@gmail.com>

12/26/2007 12:24 PM
Please respond to

To
cc
Subject
Re: Exception "XMLType mapping only supported for Oracle RDBMS"





The code in the wiki article does not take into account the fact that iBATIS logging changes the normal classes to proxy classes.  First thing to do is turn off logging to see it will work.  Second thing, the code must be modified to account for the proxy class if logging is enabled (add another instanceof check for the proxy class, then unwind the embedded "real" class).
 
See here for more information:
 
http://www.mail-archive.com/user-java@ibatis.apache.org/msg06898.html
 
Jeff Butler



On Dec 26, 2007 10:26 AM, < Jasmin_Mehta@nexweb.org> wrote:

I am using code as directed in this url:


http://opensource.atlassian.com/confluence/oss/display/IBATIS/XMLTypeHandlerCallback.java

It throw UnsupportedOperationException("XMLType mapping only supported for Oracle RDBMS");


I have logger set to DEBUG  mode.


I tried displaying class from ResultSet like :


        java.sql.ResultSet rs = getter.getResultSet();

        System.out.println("ResultSet class is: " + rs.getClass());


The cosole displays

[20 Dec 2007 15:15:05] DEBUG [PreparedStatement] {pstm-100001} Executing Statement:         SELECT OTM, SEQUENCE, MESSAGETYPE, MESSAGEID, STATUS, PROCESSED_TIME, CREATED     FROM OTM_XML  
[20 Dec 2007 15:15:05] DEBUG [PreparedStatement] {pstm-100001} Parameters: []

[20 Dec 2007 15:15:05] DEBUG [PreparedStatement] {pstm-100001} Types: []

[20 Dec 2007 15:15:05] DEBUG [ResultSet] {rset-100002} ResultSet

ResultSet class is: class $Proxy2


I am using JDeveloper
10.1.3.1

What should I change in my code to make it working?


Thanks

******************************************************************************
ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION

Our domain name is changing.  Please take note of the sender's
e-Mail address and make changes to your personal address list,
if needed.  Both domains will continue to work, only for a limited
time.
******************************************************************************
This email and any files transmitted with it are intended solely for
the use of the individual or agency to whom they are addressed.
If you have received this email in error please notify the Navy
Exchange Service Command e-mail administrator. This footnote
also confirms that this email message has been scanned for the
presence of computer viruses.

Thank You!            
******************************************************************************


------=_Part_19861_17122284.1198726206401--