Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v5.2
  Buy Now
  HXTT Cobol v2.1
  HXTT DBF v5.2
  HXTT Excel v4.2
  HXTT Paradox v5.2
  HXTT Text(CSV) v5.2
  HXTT XML v1.2
Offshore Outsourcing
Oracle Data Import/Export
DB2 Data Import/Export
Sybase Data Import/Export
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
Hongxin Technology & Trade Ltd. of Xiangtan 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


Address: 9 Station Rd., Xiangtan City, Hunan Province, P.R. China
Postcode: 411100
Phone: (86)731-58225727
Fax: (86)731-58225727
Copyright © 1999-2011 Hongxin Technology & Trade Ltd. | All Rights Reserved. | Privacy | Legal | Sitemap