We're currently using Hibernate 5.6 but are trying to upgrade to Hibernate 6.1. In one entity we have this property:
@Type(type = "text")
private String someText;
But in Hibernate 6.1, the type
field in the @Type
annotation is removed. Now the @Type
annotation is defined like this:
@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 {};
}
Question: What's the equivalent of @Type(type = "text")
in Hibernate 6.1?
CodePudding user response:
Based on Hibernate 5.0 documentation - For text
BasicTypeRegistry key corresponds LONGVARCHAR
Jdbc type.
And in Hibernate 6.1.5 documentation is offered the option to use @JdbcTypeCode
annotation:
@JdbcTypeCode(Types.LONGVARCHAR)
private String text;
CodePudding user response:
I don't know the proper syntax for using @Type
with Hibernate 6 , but as a workaround, you may try using the @Column
annotation:
@Column(columnDefinition="TEXT")
private String someText;