Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v7.1
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Cobol v5.0
  HXTT DBF v7.1
  HXTT Excel v6.1
  HXTT Json v1.0
  HXTT Paradox v7.1
  HXTT PDF v2.0
  HXTT Text(CSV) v7.1
  HXTT Word v1.1
  HXTT XML v4.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 Lab of Xi'an City (abbr, HXTT)

HXTT ACCESS
Storing binary data with hibernate
Aendy
2008-02-06 10:28:08
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:

java.lang.UnsupportedOperationException:
Blob may not be manipulated from creating session
at org.hibernate.lob.BlobImpl.excep(BlobImpl.java:104)
at org.hibernate.lob.BlobImpl.getBytes(BlobImpl.java:50)
at com.hxtt.global.ac.g(Unknown 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 com.hxtt.sql.bu.int(Unknown Source)
at com.hxtt.sql.de.a(Unknown Source)
at com.hxtt.sql.bm.a(Unknown Source)
at com.hxtt.sql.ag.a(Unknown Source)
at com.hxtt.sql.dg.char(Unknown Source)
at com.hxtt.sql.dg.executeBatch(Unknown Source)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)
... 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


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

Search Key   Search by Last 50 Questions




Google
 

Email: webmaster@hxtt.com
Copyright © 2003-2019 Heng Xing Tian Tai Lab of Xi'an City. | All Rights Reserved. | Privacy | Legal | Refund | Sitemap