openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Beer <david.m.b...@btinternet.com>
Subject Exception using H2 database
Date Sun, 17 Feb 2008 23:55:26 GMT
Hi All

I am using openjpa-1.0.1 with H2 database. I have an entity which 
contains the type byte []. I can create and add a value of a byte[] but 
can't retrieve it as I get this error.

<openjpa-1.0.1-r420667:592145 nonfatal general error> 
org.apache.openjpa.persistence.PersistenceException: 
java.io.ByteArrayInputStream cannot be cast to [B
        at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:824)
        at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:723)
        at 
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:776)
        at 
org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:257)
        at 
org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2168)
        at 
org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:251)
        at 
org.apache.openjpa.jdbc.kernel.InstanceResultObjectProvider.getResultObject(InstanceResultObjectProvider.java:59)
        at 
org.apache.openjpa.kernel.QueryImpl.singleResult(QueryImpl.java:1289)
        at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1216)
        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:990)
        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:842)
        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:773)
        at 
org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:525)
        at 
org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:237)
        at 
org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.java:300)
        at 
veilig.util.db.DatabaseFunctionsTest.getApplication(DatabaseFunctionsTest.java:123)

A bit of googling suggests that I need to overwrite the H2 DBDictionary 
value for UseGetObjectForBlobs to be false.

I tried adding this to my persistence.xml file like so <property 
name="openjpa.jdbc.DBDictionary" 
value="H2(useGetObjectForBlobs=false)"/> but then get the error H2 not 
known.

What is the JDBC Dialect that I should be setting? Or Is there a default 
DBDictonary that I should be using?

Thanks

David

Mime
View raw message