Org.hibernate.MappingException: No dialect mapping for JDBC type: -9

When I try to fetch a record from a table in SQLServer2008, I get an exception: org.hibernate.MappingException: No dialect mapping for JDBC type: -9 why?

The config file is correct though.

+1


source to share


2 answers


I changed the query and applied it explicitly to varchar and it worked .......



String myquery = "select cast(t2.name as varchar) column_name from sys.objects t1 inner join sys.columns t2 on t2.object_id = t1.object_id"+
" left join sys.indexes t3 on t3.object_id = t1.object_id and t3.is_unique = 1 left join sys.index_columns t4 on t4.object_id = t1.object_id and t4.index_id = t3.index_id and t4.column_id = t2.column_id where (upper(t1.type) = 'U' or upper(t1.type) = 'V') and upper(schema_name(t1.schema_id)) = 'dbo' and upper(t1.name) = 'TEST'"; 

      

+2


source


This is a hibernate mapping type issue.

you can expand the dialect. eg:



public class SQLServerDialectOverrider extends SQLServerDialect{
    public SQLServerDialectOverrider() {
        super();
        registerHibernateType(Types.NVARCHAR, Hibernate.STRING.getName());
        registerHibernateType(Types.LONGVARCHAR, Hibernate.TEXT.getName());
    }
}

      

Use this class as a dialect class.

+10


source







All Articles