获取org.hibernate.MappingException:否JDBC类型的方言映射:-4异常? [英] Getting org.hibernate.MappingException: No Dialect mapping for JDBC type: -4 exception?

查看:113
本文介绍了获取org.hibernate.MappingException:否JDBC类型的方言映射:-4异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 query.list()行接收异常:

  org.hibernate .MappingException:否JDBC类型的方言映射:-4 
位于org.hibernate.dialect.TypeNames.get(TypeNames.java:56)
位于org.hibernate.dialect.TypeNames.get(TypeNames。
at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:369)
at org.hibernate.loader.custom.CustomLoader $ Metadata.getHibernateType(CustomLoader.java:559)
at org.hibernate.loader.custom.CustomLoader $ ScalarResultColumnProcessor.performDiscovery(CustomLoader.java:485)
at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:501)
在org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
在org.hibernate.loader.Loader.doQuery(Loader.java:662)
在org.hibernate.loader .Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2211)
在org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
在org.hibernate.loader.Loader.list(Loader.java:2090)
在org.hibernate .loader.custom.CustomLoader.list(CustomLoader.java:289)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
at org.hibernate.impl.AbstractSessionImpl.list (AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)

以下是我的配置文件:

 < property name =hibernate.connection.driver_resource> ; com.mysql.jdbc.Driver< /性> 
< property name =hibernate.connection.password> mysql< / property>
< property name =hibernate.connection.url> jdbc:mysql:// localhost:3306 / mydatabase< / property>
< property name =hibernate.connection.username>根< / property>
< property name =hibernate.default_schema> mydatabase< / property>
< property name =hibernate.dialect> org.hibernate.dialect.MySQL5InnoDBDialect< / property>

当我试图在Eclipse IDE中运行应用程序时,这个异常不会到来,但是当我创建jar的应用程序和运行,然后只有我得到它。
在此先感谢...

解决方案

获得解决方案:

只需更改查询,即可获取整个记录而不是选择特定的记录。
例如 from table ,然后从表Object中获取相应的字段(此处为脚本)值,而不是使用从表中选择脚本,现在工作正常。


I am getting following exception at query.list() line:

org.hibernate.MappingException: No Dialect mapping for JDBC type: -4
    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:369)
    at org.hibernate.loader.custom.CustomLoader$Metadata.getHibernateType(CustomLoader.java:559)
    at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.performDiscovery(CustomLoader.java:485)
    at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:501)
    at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
    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:2211)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
    at org.hibernate.loader.Loader.list(Loader.java:2090)
    at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
    at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
    at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
    at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)

following is my configuration file:

<property name="hibernate.connection.driver_resource">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.password">mysql</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/mydatabase</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.default_schema">mydatabase</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>

When I am trying to run application into Eclipse IDE then this exception is not coming but when I create jar of application and run then only I am getting it. thanks in advance...

解决方案

Got the solution:

Just change the Query, I am fetching whole record instead of select specific. e.g. from table and then get respective field (here script) value from table Object instead of using select script from table, It is working fine now.

这篇关于获取org.hibernate.MappingException:否JDBC类型的方言映射:-4异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆