[ 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)
regards,
Armin
/**
* 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;
try
{
Object bfile = rs.getObject(columnName);
bfile.getClass().getMethod("open", new Class[]{}).invoke(bfile,
new Object[]{});
if(!rs.wasNull())
{
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[]{});
stream.read(result);
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 easier.
> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]