question: public void testSetObject_int_Object_int_int ( ) throws SQLException { PreparedStatement ps = null ; try { String query = "insert into type (IntVal) values (?);" ; ps = conn . prepareStatement ( query ) ; Statement st = null ; try { ps . setObject ( 1 , Integer . MAX_VALUE , Types . INTEGER , Integer . MAX_VALUE ) ; ps . execute ( ) ; st = conn . createStatement ( ) ; st . execute ( "select * from type where IntVal=" + Integer . MAX_VALUE ) ; ResultSet rs = st . getResultSet ( ) ; assertEquals ( 1 , getCount ( rs ) ) ; } finally { try { st . close ( ) ; } catch ( Exception ee ) { } } query = "insert into type (LongVal) values (?);" ; ps = conn . prepareStatement ( query ) ; try { ps . setObject ( 1 , "test text" , Types . CHAR , Integer . MIN_VALUE ) ; ps . execute ( ) ; st = conn . createStatement ( ) ; st . execute ( "select * from type where LongVal='test text';" ) ; ResultSet rs = st . getResultSet ( ) ; assertEquals ( 1 , getCount ( rs ) ) ; } finally { try { st . close ( ) ; } catch ( Exception ee ) { } } query = "insert into type (DecVal) values (?);" ; ps = conn . prepareStatement ( query ) ; BigDecimal bd2 = new BigDecimal ( "12.21" ) ; ps . setObject ( 1 , bd2 , Types . DECIMAL , 2 ) ; ps . execute ( ) ; query = "insert into type (dateVal) values (?);" ; ps = conn . prepareStatement ( query ) ; Date d = new Date ( 123456789 ) ; try { ps . setObject ( 1 , d , Types . DATE , - 1 ) ; ps . execute ( ) ; st = conn . createStatement ( ) ; st . execute ( "select * from type where dateVal='" + d . getTime ( ) + "';" ) ; ResultSet rs = st . getResultSet ( ) ; assertEquals ( 1 , getCount ( rs ) ) ; } finally { try { st . close ( ) ; } catch ( Exception ee ) { } } query = "insert into type(BlobVal) values (?);" ; ps = conn . prepareStatement ( query ) ; try { ps . setObject ( 1 , "" , Types . BLOB , 0 ) ; ps . execute ( ) ; } finally { try { st . close ( ) ; } catch ( Exception ee ) { } } } finally { try { ps . close ( ) ; } catch ( Exception ee ) { } } try { ps . setObject ( 1 , "test text" , Types . CHAR , Integer . MIN_VALUE ) ; fail ( "Exception not thrown" ) ; } catch ( SQLException e ) { } }
target:  This test doesn't pass on RI; Fails for Types.DATE