运行休眠5时会弹出Microsoft SQL变体类型错误 [英] Microsoft SQL variant type error pops up when I run hibernate 5

查看:75
本文介绍了运行休眠5时会弹出Microsoft SQL变体类型错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我运行休眠5时,都会看到此错误:

Whenever I run my hibernate 5, I see this error:

ERROR: Could not fetch the SequenceInformation from the database
com.microsoft.sqlserver.jdbc.SQLServerException: The "variant" data type is not supported.

我以前从未听说过变体"数据类型.还是数据类型的一类?不确定.

I've never heard of a "variant" data type before. Or is it a category of data types? Not sure.

我检查了所有表中的数据类型,这些类型是:bigint,位,日期,日期时间,int,数值,varbinary和varchar.

I checked the data types in all my tables, and these are the ones that are there: bigint, bit, date, datetime, int, numeric, varbinary, and varchar.

此错误来自何处?还有其他地方我应该检查变体类型吗?

Where could this error be coming from? Is there somewhere else I should check for variant types?

我运行了此查询,从中选择了不同的data_type,以获取数据库中的所有数据类型,但是sql变体没有显示.这就是我确定没有的方式.

I ran this query select distinct data_type from INFORMATION_SCHEMA.COLUMNS to get all the data types in my database, and sql variant didn't show up. That's how I'm sure there isn't one.

还有其他地方可以引用吗?

Is there somewhere else this could be referenced?

有关此的更多信息.该应用程序是一个Maven项目.我创建了一个普通的Java项目,并在相同的数据库上运行了相同的代码,但是我对SQL变体类型没有任何错误.

A little bit more information on this. The application is a maven project. I created a normal java project and ran the same codes against the same database, and I didn't get any error about sql variant types.

因此,此问题似乎与休眠依赖关系有关.我真的不明白.这是我正在使用的依赖项:

So this issue seems to be tied to the hibernate dependency. I don't get it, really. This is the dependency I'm using:

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.4.0.Final</version>
        </dependency>

推荐答案

好的.因此,我检查了我在普通Java应用程序中使用的库,它是Hibernate 5.3.7.我在Maven应用程序中使用的是5.4.0.

Alright. So, I checked the library I was using in my normal java application, and it's Hibernate 5.3.7. The one I'm using in my maven application is 5.4.0.

因此我将Maven应用程序中的休眠库更改为:

So I changed the hibernate library in my maven app to:

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>5.3.7.Final</version>
    </dependency>

现在一切正常.没有抱怨一些怪异的Sql Variant类型.

And now everything works. No complaints about some weird some weird Sql Variant type.

此问题也影响Hibernate搜索5.11.0.您应该使用5.10.5.Final.

This issue also affects Hibernate search 5.11.0. You should use 5.10.5.Final.

不幸的是,我没有适当的凭据来向休眠团队的问题跟踪器提出这一要求.希望他们中的一个会遇到这个帖子并解决它.我知道他们正在使用冬眠搜索6和冬眠ORM 6,所以这是个好消息!

Unfortunately, I don't have the proper credentials to raise this with the hibernate team on their issues tracker. Hopefully one of them will come across this post and address it. I know they're working on a hibernate search 6 and hibernate ORM 6, so that's good news!

这篇关于运行休眠5时会弹出Microsoft SQL变体类型错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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