How to fix “No Dialect mapping for JDBC type: -1” error in java

后端 未结 2 1179
走了就别回头了
走了就别回头了 2020-12-21 18:52

i\'m getting one error how to resolve this error i.e,

org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
  at org.hibernate.dialect.TypeNam         


        
相关标签:
2条回答
  • 2020-12-21 19:35

    For my case the type was missing, so setting qu.addEntity(MyBean.class); worked, in your case String.class might work

    0 讨论(0)
  • 2020-12-21 19:45

    With me I was having trouble with an unmapped MySQL table column.

    Column Type: text

    Then I had to use addScalar():

    Query query =  em. createNativeQuery(originalQuery);
    ((SQLQuery) ((HibernateQuery) query).getHibernateQuery())
                .addScalar("column1", new LongType())
                .addScalar("column2", new IntegerType())
                .addScalar("column3", new StringType());
    List<Object[]> values = query.getResultList();
    
    0 讨论(0)
提交回复
热议问题