public final Object nullSafeGet(ResultSet rs, String name) throws HibernateException, SQLException { try { Object value = get(rs, name); if ( value == null || rs.wasNull() ) { if ( IS_TRACE_ENABLED ) { log().trace( "returning null as column: " + name ); } return null; } else { if (IS_TRACE_ENABLED) { log().trace( "returning '" + toString( value ) + "' as column: " + name ); } return value; } } catch ( RuntimeException re ) { log().info( "could not read column value from result set: " + name + "; " + re.getMessage() ); throw re; } catch ( SQLException se ) { log().info( "could not read column value from result set: " + name + "; " + se.getMessage() ); throw se; } }
public final void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException { try { if ( value == null ) { if ( IS_TRACE_ENABLED ) { log().trace( "binding null to parameter: " + index ); } st.setNull( index, sqlType() ); } else { if ( IS_TRACE_ENABLED ) { log().trace( "binding '" + toString( value ) + "' to parameter: " + index ); } set( st, value, index ); } } catch ( RuntimeException re ) { log().info( "could not bind value '" + toString( value ) + "' to parameter: " + index + "; " + re.getMessage() ); throw re; } catch ( SQLException se ) { log().info( "could not bind value '" + toString( value ) + "' to parameter: " + index + "; " + se.getMessage() ); throw se; } }