db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Armin Waibel (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OJB-80) OJB support of Oracle's bfile attribute
Date Mon, 16 Oct 2006 11:01:36 GMT
    [ http://issues.apache.org/jira/browse/OJB-80?page=comments#action_12442544 ] 
Armin Waibel commented on OJB-80:

Hi Eric,

the only way to include  oracle's BFILE support is to implement it via reflection - see a
modified implementation below.
What do you think would be the better solution: 
1. add BFILE support via reflection
2. add a T_BFile implementation hint in documentation (e.g. in FAQ)


     * Oracle's BFILE type
    public static final class T_BFile extends BaseType

        public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException
            throw new SequenceManagerException("Not supported sequence key type 'BFILE'");

        Object readValueFromStatement(CallableStatement stmt, int columnIndex) throws SQLException
            throw new SQLException("not supported");

        Object readValueFromResultSet(ResultSet rs, String columnName) throws SQLException
            byte[] result = null;
                Object bfile = rs.getObject(columnName);
                bfile.getClass().getMethod("open", new Class[]{}).invoke(bfile, new Object[]{});
                    int len = ((Long) bfile.getClass().getMethod("length", new Class[]{}).invoke(bfile,
new Object[]{})).intValue();
                    result = new byte[len];
                    InputStream stream = (InputStream) bfile.getClass().getMethod("getBinaryStream()",
new Class[]{}).invoke(bfile, new Object[]{});
                    bfile.getClass().getMethod("close", new Class[]{}).invoke(bfile, new Object[]{});
                bfile.getClass().getMethod("close", new Class[]{}).invoke(bfile, new Object[]{});
            catch(SQLException e)
                throw e;
            catch(Exception e)
                throw new OJBRuntimeException("Can't read Oracle's BFILE type", e);
            return result;

        Object readValueFromResultSet(ResultSet rs, int columnIndex) throws SQLException
            throw new SQLException("not supported");

        public int getType()
            return Types.BLOB;

> OJB support of Oracle's bfile attribute
> ---------------------------------------
>                 Key: OJB-80
>                 URL: http://issues.apache.org/jira/browse/OJB-80
>             Project: OJB
>          Issue Type: Bug
>          Components: ODMG-API
>    Affects Versions: 1.0.3
>         Environment: ALL
>            Reporter: Eric Ferrer
>         Attachments: JdbcTypesHelper.java
> We are using the BFILE type in Oracle and  org.apache.ojb.broker.util.JdbcTypesHelper.java
does not support BFILE.  We have added the support for BFILE in this class but we would like
it to be standardize in OJB.  This would make the upgrading to different ojb builds a lot
> Thanks.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org

View raw message