Hi,
We have an application, that was working well using Hibernate 3.5.6. After we updated to Hibernate 3.6.0 we have problems with the MySQL version.
After the update we have problems when we write blobs. We get an exception that some characters are invalid:
Code:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '^O\0^A\0^A\0\0\0\0\0\0\0\0\0\0\0\0\0^Y^A?\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0' at line 1
We use an Jdbc URL defining the "sql_mode=NO_BACKSLASH_ESCAPES". When I remove this configuration the blobs can be written and read, but the tests using queries with backslashes fail, which works find when "sql_mode=NO_BACKSLASH_ESCAPES" is set.
It seems that streams are not used any more by default for MySQL. I tried to define hibernate.jdbc.use_streams_for_binary=true in a hibernate.properties file, but that did not work either. This will lead to conversion exceptions when reading the blob:
Code:
org.springframework.orm.jpa.JpaSystemException: org.hibernate.HibernateException: Unknown unwrap conversion requested: java.sql.Blob to org.hibernate.type.descriptor.BinaryStream;
nested exception is javax.persistence.PersistenceException: org.hibernate.HibernateException: Unknown unwrap conversion requested: java.sql.Blob to org.hibernate.type.descriptor.BinaryStream
javax.persistence.PersistenceException: org.hibernate.HibernateException: Unknown unwrap conversion requested: java.sql.Blob to org.hibernate.type.descriptor.BinaryStream
org.hibernate.HibernateException: Unknown unwrap conversion requested: java.sql.Blob to org.hibernate.type.descriptor.BinaryStream
Maybe there is some kind of configuration option I am missing. Any hint is welcome.
Thanks in advance,
Tom