[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6834) skip test BasicOperationsTest on oracle due to a oracle jdbc driver issue

Strong Liu (JIRA) noreply at atlassian.com
Mon Nov 21 02:45:19 EST 2011


skip test BasicOperationsTest on oracle due to a oracle jdbc driver issue
-------------------------------------------------------------------------

                 Key: HHH-6834
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6834
             Project: Hibernate Core
          Issue Type: Bug
          Components: testsuite
            Reporter: Strong Liu
            Assignee: Strong Liu
            Priority: Minor
             Fix For: 4.0.0.next


{quote}
Hi all,
For a long time, I have been using the Oracle classes12.jar in Tomcat for connection to an Oracle database.  I was doing some testing with Oracle AS 10g in prep for a production migration and found an interesting problem.  The class type that is returned from the meta data on the ResultSet is not the same type as the actual value using getObject() when dealing with Date fields.  I noticed this because I use RowSetDynaClass from Commons BeanUtils.  It seems to be a problem with the ojdbc14.jar files because I replaced the drivers in Tomcat and was able to repeat the problem.

Specific example:
create a table with a Date field and populate with information (at least one row).

PreparedStatement stmt = conn.prepareStatement("select * from someTable");
ResultSet rs = stmt.executeQuery();
ResultSetMetaData meta = rs.getMetaData();

try{
   int colCount = meta.getColumnCount();
   if(rs.next()){
      for(int i=1; i<=colCount; i++){
          Object v = rs.getObject(i);
          String value = "";
          if(v != null){
              value = v.getClass().getName();
          }
          else{
              value = "Null";
          }
          System.out.println("Col: "+meta.getColumnName(i)+", meta type: "+meta.getColumnClassName(i)+", actual: "+value);
      }
   }


} catch(Exception e){
   // print error info
}

//output
Col: create_date, meta type: java.sql.Timestamp, actual: java.sql.Date

Has anyone else ran into this?  If so, any thoughts on a workaround?  I posted a simlar question on the Oracle Technology Network on Thursday and have yet to receive a response.  RowSetDynaClass relies on the meta data to convert the actual value, so my only thought right now is to create a ResultSet decorator to "fix" this discrepancy.  

{quote}

copied from http://www.experts-exchange.com/Programming/Languages/Java/Q_21511374.html

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list