This is one exception that can occur one day when you are using Hibernate and PostgreSQL. Basically it occur when you have an entity that has one float mapped property and you create one HQL query using the HQL built-in-functions, such as: SUM, AVG, COUNT, with left outer joins or simple queries.
org.hibernate.MappingException: No Dialect mapping for JDBC type: 7
There are two ways to solve the problem: the first is to change property type to Double and the second is to create a customized dialect:
public class PostgreSQLDialect extends org.hibernate.dialect.PostgreSQLDialect {
public PostgreSQLDialect() {
super();
registerColumnType(Types.REAL, ânumber($p,$s)â );
registerHibernateType(Types.REAL, âfloatâ);
}
}
SQL type 7 corresponds to JDBC float type, then we need to register column data type and register hibernate data type too.
Comentarios recentes