Code example for ResultSet

Methods: getInt, getString, wasNull

0
    public Object nullSafeGet(ResultSet rs, String[] names, Object owner)
            throws HibernateException, SQLException { 
 
        boolean isnull = false;
 
        int enabled = rs.getInt(names[0]);
        isnull |= rs.wasNull();
        int position    = rs.getInt(names[1]);
        isnull |= rs.wasNull();
        int transpar    = rs.getInt(names[2]);
        isnull |= rs.wasNull();
        String url      = rs.getString(names[3]);
        isnull |= rs.wasNull();
 
        if(isnull)
            return null; 
        else { 
            WatermarkInfoImpl watermark = new WatermarkInfoImpl();
            watermark.setEnabled(enabled!=0);
            watermark.setPosition(Position.get(position));
            watermark.setTransparency(transpar);