Code example for Blob

Methods: getBytes, length

0
                javaValue = new java.util.Date(((java.sql.Date) jdbcValue).getTime());
            } 
        } else if (jdbcValue instanceof Blob && property.getType().equals(byte[].class)) {
            Blob blob = (Blob) jdbcValue;
            try { 
                long llength = (int) blob.length();
                // completely artificial limit of 42 megabytes... 
                if (llength > 42 * 1024 * 1024) {
                    throw new IllegalStateException("blob too large to assign to byte[] (limit is 42M)");
                } 
                int length = (int) llength;
                javaValue = blob.getBytes(1, length);
            } catch (SQLException e) {
                throw new IllegalArgumentException(e.getMessage());
            } 
 
        } else { 
            // add more here if required 
        } 
        return javaValue;
    }