2 Replies Latest reply on Mar 12, 2007 10:31 AM by darren hartford

    No Dialect mapping for JDBC type

    Krishna Attravanam Newbie

      When I run this code,
      .....
      int id = 20; //Id is the primary key in the db table
      Query query = em.createNativeQuery("select p.* from Person where p.id = " + id);
      log.debug(query.getResultList());
      .......

      I get the following exception:

      Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.MappingException: No Dialect mapping for JDBC type: -1

      Caused by: org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
      at org.hibernate.dialect.TypeNames.get(TypeNames.java:56)
      at org.hibernate.dialect.TypeNames.get(TypeNames.java:81)
      at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:217)
      at org.hibernate.loader.custom.CustomLoader.getHibernateType(CustomLoader.java:176)
      at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:146)
      at org.hibernate.loader.Loader.getResultSet(Loader.java:1678)
      at org.hibernate.loader.Loader.doQuery(Loader.java:662)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
      at org.hibernate.loader.Loader.doList(Loader.java:2145)
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
      at org.hibernate.loader.Loader.list(Loader.java:2024)
      at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:118)
      at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1684)
      at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
      at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:164)
      at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:53)
      ... 5 more


      Any help will be appreciated.

      Thanks
      K