我们当前使用 Hibernate 5.6,但正在尝试升级到 Hibernate 6.1。在一个实体中,我们具有以下属性:
@Type(type = "text")
private String someText;
Run Code Online (Sandbox Code Playgroud)
但在Hibernate 6.1中,注释type中的字段@Type被删除了。现在@Type注释的定义如下:
@java.lang.annotation.Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Type {
/**
* The implementation class which implements {@link UserType}.
*/
Class<? extends UserType<?>> value();
/**
* Parameters to be injected into the custom type after it is
* instantiated. The {@link UserType} implementation must implement
* {@link org.hibernate.usertype.ParameterizedType} to receive the
* parameters.
*/
Parameter[] parameters() default {};
}
Run Code Online (Sandbox Code Playgroud)
@Type(type = "text")问题: Hibernate 6.1 中相当于什么?
基于Hibernate 5.0 文档- 对于textBasicTypeRegistry 键对应于LONGVARCHARJdbc 类型。
在Hibernate 6.1.5 文档中提供了使用注释的选项@JdbcTypeCode:
@JdbcTypeCode(Types.LONGVARCHAR)
private String text;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6645 次 |
| 最近记录: |