Dialect should make it possible override SqlTypeDescriptor for Types.BLOB

Description

I have a problem with hibernate and MySQL and inserting a blob.

In our previous version of hibernate (3.6.0) a blob was inserted into the database
with BlobTypeDescriptor.STREAM_BINDING.
Now the blob is persisted with BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING.
(see org.hibernate.type.descriptor.sql.BlobTypeDescriptor.DEFAULT and the doBind method)

The latter uses twice (2x!) the number of bytes (I think a byte is encoded as hex) as the streaming option.
In our junittest we now get the exception "com.mysql.cj.jdbc.exceptions.PacketTooBigException"

I noticed that the problem doesn't exist for Clob. A solution for Clob is made in org.hibernate.dialect.Dialect.
I think the same solution should be made for Blob.

In Dialect.java the following code is in method Dialect.getSqlTypeDescriptorOverride(int sqlCode):

The method could be changed to:

 

Environment

None

Assignee

Unassigned

Reporter

Kees Kuip

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

Yes, likely

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

3.6.0

Components

Affects versions

Priority

Major
Configure