You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Patrick Linskey (JIRA)" <ji...@apache.org> on 2008/02/20 22:35:43 UTC

[jira] Commented: (OPENJPA-484) H2Dictionary has 'useGetObjectForBlobs' set to true, which should be false

    [ https://issues.apache.org/jira/browse/OPENJPA-484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12570836#action_12570836 ] 

Patrick Linskey commented on OPENJPA-484:
-----------------------------------------

This can be worked around with the following configuration setting:

    <property name="openjpa.jdbc.DBDictionary" value="UseGetObjectForBlobs=false"/>

> H2Dictionary has 'useGetObjectForBlobs' set to true, which should be false
> --------------------------------------------------------------------------
>
>                 Key: OPENJPA-484
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-484
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, sql
>    Affects Versions: 1.0.1, 1.1.0
>         Environment: H2 Database - v1.0.64, Java SE6
>            Reporter: Prashant Bhat
>
> From H2 Database forum http://groups.google.com/group/h2-database/browse_thread/thread/fab7dd4424445c9b
> H2Dictionary has 'useGetObjectForBlobs' set to true, whereas the default in DBDictionary is false. So for an entity with a property of type byte[] which is mapped as blob,  loading fails because, the 'getBytes' method uses 'rs.getObject(column);' which fails with the following exception:
> Caused by: java.lang.ClassCastException: java.io.ByteArrayInputStream cannot be cast to [B
>         at org.apache.openjpa.jdbc.sql.DBDictionary.getBytes(DBDictionary.java:531)
>         at org.apache.openjpa.jdbc.sql.ResultSetResult.getBytesInternal(ResultSetResult.java:278)
>         at org.apache.openjpa.jdbc.sql.ResultSetResult.getObjectInternal(ResultSetResult.java:404)
>         at org.apache.openjpa.jdbc.sql.AbstractResult.getObject(AbstractResult.java:662)
>         at org.apache.openjpa.jdbc.meta.strats.HandlerStrategies.loadDataStore(HandlerStrategies.java:205)
>         at org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy.load(HandlerFieldStrategy.java:172)
>         at org.apache.openjpa.jdbc.meta.FieldMapping.load(FieldMapping.java:796)
>         at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:841)
>         at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:793)
>         at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:483)
>         at org.apache.openjpa.kernel.DelegatingStoreManager.load(DelegatingStoreManager.java:116)
>         at org.apache.openjpa.kernel.ROPStoreManager.load(ROPStoreManager.java:78)
>         at org.apache.openjpa.kernel.StateManagerImpl.loadFields(StateManagerImpl.java:2893)
>         at org.apache.openjpa.kernel.StateManagerImpl.loadField(StateManagerImpl.java:2971)
>         at org.apache.openjpa.kernel.StateManagerImpl.beforeAccessField(StateManagerImpl.java:1476)
>         at org.apache.openjpa.kernel.StateManagerImpl.accessingField(StateManagerImpl.java:1461) 
> I've tried setting 'useGetObjectForBlobs' to false(by just commenting it!), it is working. So please change this to false.
> Thanks,

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.