JPA SQL Server No Dialect Mapping for Jdbc Type: -9

Hibernate : No Dialect mapping for JDBC type: 101

Try it like this:

Object result = session.createSQLQuery(
"SELECT " +
" rownum as id, " +
" mm.metric_name, " +
" dm.aggregated_value_float, " +
" dm.created_timestamp as dm_timestamp, " +
" s.type, " +
" s.name as subelement_name " +
"FROM " +
" daily_metric dm, " +
" subelement s, " +
" metric_metadata mm " +
"WHERE " +
" dm.subelement_id =s.subelement_id AND " +
" TRUNC(dm.created_timestamp)='15-JAN-15' AND " +
" s.subelement_id =1456376 AND " +
" dm.metric_metadata_id = mm.metric_metadata_id " +
"ORDER BY 1,2 DESC")
.addScalar("dm_timestamp", TimestampType.INSTANCE)
.uniqueResult();

MappingException: No Dialect mapping for JDBC type: 2002

I solved given problem with .addEntity(Webpage.class)
:

hqlQuery =  sessionFactory
.getCurrentSession()
.createSQLQuery(buildSearchQuery())
.addEntity(Webpage.class);

Spring Hibernate: No Dialect mapping for JDBC type: -101

Well, I found the problem.

The error message it gives seems misleading to me, as it doesn't match what the solution is.

I needed to provide the createNativeQuery function with a .class to cast the results too.

em.createNativeQuery(<query>, PTags.class) fixed the issue

JPA - No Dialect mapping for JDBC type: 1111 when calling a postgresql function with varchar

It seems Hibernate is not happy about the function returning VOID, so changing it to return INT and just calling RETURN 1 at the end solved the problem.



Related Topics



Leave a reply



Submit