No Dialect mapping for JDBC type: -4

Yet another fun day with hibernate.
While working on ResourcePhaseListener for JSF attachment problem I run into following problem while trying to retrieve BLOB from MySQL db.

org.hibernate.MappingException: No Dialect mapping for JDBC type: -4 No Dialect mapping for JDBC type: -4

Here is the offending code:

SerializableBlob result= null;
Session hibSession=(Session) em.getDelegate();
result = (SerializableBlob)	
hibSession.createSQLQuery("Select DATA from Table")	
.addScalar("DATA", Hibernate.BLOB)			
.uniqueResult();				

Adding the mapping addScalar("DATA", Hibernate.BLOB) solved the problem.

Leave a Comment

Your email address will not be published. Required fields are marked *