线程“main”中的异常javax.persistence.PersistenceException:org.hibernate.MappingException:没有JDBC类型的Dialect映射:-151

时间:2018-06-07 12:34:56

标签: java hibernate

我有一个问题

这是我的项目依赖项:

org.springframework.boot<spring-boot-starter-data-jpa>

org.eclipse.persistence <eclipselink>

为了解决这个问题,我配置了一个类

public class SqlServerDialect extends SQLServer2008Dialect  {  
    public SqlServerDialect() {   
        super();  
        registerHibernateType(-151, org.hibernate.type.TimestampType.INSTANCE.getName());
    }   
}

然后我收到以下错误

Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.MappingException: No Dialect mapping for JDBC type: -151
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1692)
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1602)
    at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:492)
    at com.lilanz.microservice.common.tools.NativeQuery.getResultList(NativeQuery.java:56)
    at com.lilanz.microservice.common.tools.NativeQuery.sqlServerSearch(NativeQuery.java:86)
    at com.lilanz.microservice.common.tools.NativeQuery.sqlServerSearch(NativeQuery.java:90)
    at com.lilanz.microservice.common.Test.main(Test.java:41)
Caused by: org.hibernate.MappingException: No Dialect mapping for JDBC type: -151
    at org.hibernate.dialect.TypeNames.get(TypeNames.java:70)
    at org.hibernate.dialect.TypeNames.get(TypeNames.java:101)
    at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:666)
    at org.hibernate.loader.custom.JdbcResultMetadata.getHibernateType(JdbcResultMetadata.java:77)
    at org.hibernate.loader.custom.ScalarResultColumnProcessor.performDiscovery(ScalarResultColumnProcessor.java:45)
    at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:487)
    at org.hibernate.loader.Loader.getResultSet(Loader.java:2125)
    at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1900)
    at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1876)
    at org.hibernate.loader.Loader.doQuery(Loader.java:919)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336)
    at org.hibernate.loader.Loader.doList(Loader.java:2617)
    at org.hibernate.loader.Loader.doList(Loader.java:2600)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2429)
    at org.hibernate.loader.Loader.list(Loader.java:2424)
    at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:336)
    at org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1967)
    at org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:322)
    at org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:125)
    at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:606)
    at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:483)
    ... 4 more

你能帮我理解错误是什么-151(java.sql.Types)?

0 个答案:

没有答案