Wednesday, 23 April 2008

No Dialect mapping for JDBC type: -1

This Hibernate error came at me out of the blue while working on FilmSuggestions.com - I innocently added a constraint to one of my Grails domain models, setting the maxSize of one of the fields to 2000. This changed the table schema making the column type TEXT instead of VARCHAR.

The problem came from a native query:
sessionFactory.getCurrentSession().createSQLQuery(mostPopularFilmsSQL).list()

This selects the TEXT column which results in the error (as described here). Setting the dialect didn't seem to make any difference, so for now I've changed the constraint so it's back to being a VARCHAR.

0 comments:

Post a Comment