JavaTypeDescriptorRegistry - 找不到所请求Java类的匹配类型描述符 [英] JavaTypeDescriptorRegistry - Could not find matching type descriptor for requested Java class

查看:1417
本文介绍了JavaTypeDescriptorRegistry - 找不到所请求Java类的匹配类型描述符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行没有问题的项目,除了这个警告信息:

I have a project running with no problem except this warning message:

WARN  org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry - Could not find matching type descriptor for requested Java class [java.util.List]; using fallback enviroment

为什么我会收到此消息?我该如何禁用它?

Why am I getting this message? How can I disable it?

我使用的是:

I'm using:

spring webmvc 4.2.1
hibernate-core 5.0.1

由于我使用的是JPA 2.1 AttributeConverter,因此出现此消息。

This message appears since I'm using JPA 2.1 AttributeConverter.

推荐答案

如果转换器应该转换的类型没有实现 Serializable

You get this warning if the type your converter is supposed to convert does not implement Serializable, is not an enum nor one of the types Hibernate knows how to convert. As soon as you make the type your converter is supposed to convert Serializable, the warning goes away.

透视Hibernate代码, JavaTypeDescriptor 的用途似乎是提供有关如何序列化某些类型以及是否或如何可以执行深度复制的信息。因为Hibernate对这个类型一无所知,所以它做出一些猜测。如果你愿意,你可以通过自己提供一个 JavaTypeDescriptor 来帮助Hibernate。有一个 Singleton

Looking through the Hibernate code, the purpose of a JavaTypeDescriptor seems to be to provide information on how to serialize certain types and whether or how it's possible to do deep copies. Because Hibernate doesn't know anything about the type, it makes some guesses. If you like, you can help Hibernate by supplying a JavaTypeDescriptor yourself. There's a Singleton for that.

这篇关于JavaTypeDescriptorRegistry - 找不到所请求Java类的匹配类型描述符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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