Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v6.0
  Buy Now
  HXTT Cobol v3.0
  HXTT DBF v6.0
  HXTT Excel v5.0
  HXTT Paradox v6.0
  HXTT Text(CSV) v6.0
  HXTT XML v2.0
Offshore Outsourcing
Free Resources
  Firewall Tunneling
  Search Indexing Robot
  Conditional Compilation
  Password Recovery for MS Access
  Password Recovery for Corel Paradox
  Checksum Tool for MD5
  Character Set Converter
  Pyramid - Poker of ZYH
Heng Xing Tian Tai Ltd. of Beijing City (abbr, HXTT)

Storing binary data with hibernate
2008-02-06 10:28:08.0
I experienced some problems storing binary data into an Access database with hibernate using the HXTT Access JDBC driver.

First problem:

It is not possible to use the hibernate type 'blob' with the HXTT Access JDBC driver. Inserting some binary data into a blob field crahes with the following exception:

Blob may not be manipulated from creating session
at org.hibernate.lob.BlobImpl.excep(
at org.hibernate.lob.BlobImpl.getBytes(
at Source)
at com.hxtt.sql.access.f.a(Unknown Source)
at com.hxtt.sql.access.j.a(Unknown Source)
at com.hxtt.sql.access.j.a(Unknown Source)
at com.hxtt.sql.access.a2.a(Unknown Source)
at com.hxtt.sql.w.a(Unknown Source)
at com.hxtt.sql.b0.for(Unknown Source)
at Source)
at Source)
at Source)
at Source)
at com.hxtt.sql.dg.char(Unknown Source)
at com.hxtt.sql.dg.executeBatch(Unknown Source)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(
at org.hibernate.jdbc.AbstractBatcher.executeBatch(
at org.hibernate.engine.ActionQueue.executeActions(
at org.hibernate.engine.ActionQueue.executeActions(
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(
at org.hibernate.impl.SessionImpl.flush(
at org.hibernate.impl.SessionImpl.managedFlush(
at org.hibernate.transaction.JDBCTransaction.commit(
at org.hibernate.ejb.TransactionImpl.commit(
... 13 more

Although this Exception is thrown by hibernate, this is a JDBC driver problem. Because of this limitation, it is not possible to use HXTT Access in a JPA (Java Persistence API) environment, where a large amount of binary data needs to be stored (at least not in a database independent way; we need to support SQL Server, MySQL and Oracle as well).

Second problem:

As you might know, hibernate can automatically create all tables of a database for you when the hibernate session factory is beeing started. Creating a table for a Java class with an attriute of type 'byte[]' will always fail with the following error message if the hibernate type is 'binary', 'varbinary' or 'longvarbinary':

ERROR [SchemaUpdate] Unsuccessful:
create table MATERIAL_IMAGE (DISCRIMINATOR varchar(31) not null, id bigint not null, DESCRIPTION varchar(255) null, IMAGE_DATA varbinary null, primary key (id))

ERROR [SchemaUpdate] Syntax error: Stopped parse at null

The driver does not accept the keyword 'null' after 'IMAGE_DATA' varbinary. So it's not possible to let hibernate create your tables, if you data model uses one of the hibernate types 'binary', 'varbinary' or 'longvarbinary'.

Best regards

Re:Storing binary data with hibernate
2008-02-25 12:22:07.0
Any answer?

Search Key   Search by Last 50 Questions


Copyright © 1999-2017 Heng Xing Tian Tai Ltd. of Beijing City. | All Rights Reserved. | Privacy | Legal | Sitemap