Menu

ResultMap that uses type java.sql.Timestamp

2003-06-18
2003-06-18
  • Nobody/Anonymous

    I would like to use the type java.sql.Timestamp in my ResultMap, but I am getting:

    Check the Result Map.  Check the 'timestamp' property. Cause: java.sql.SQLException: Could not apply result map to property named 'timestamp'.  Unknown type encountered (class java.sql.Timestamp).  Please use a supported type or associate a mapped-statement with this type.

    It looks like I might be able to use this type, as noted on page 11 of the documentation, but when I explicitly declare the type "TIMESTAMP" next to the property that is declared java.sql.Timestamp, I still have the problem.

    Thanks

     
    • Nobody/Anonymous

      The great thing about the framework is that you can isolate your business objects from java.sql.* types.  There is no need to declare the property as type java.sql.Timestamp.   Simply declare your property as a java.util.Date and it will be retrieved using ResultSet.getTimeStamp().  If you want to explicitly use DATE or TIME types, or if the column is nullable, then you will want to specify type="..." in the <property> element.

      Cheers,
      Clinton

       

Log in to post a comment.