code
package com.example.BLModel;
import org.hibernate.annotations.Type;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MapsId;
import javax.persistence.Table;
@Entity
@Table(name = "email_template_custom")
public class EmailTemplateCustom {
@EmbeddedId
private EmailTemplateCustomId id;
@MapsId("tenantId")
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "tenant_id", nullable = false)
private Tenant tenant;
@Column(name = "email_subject", nullable = false, length = 1000)
private String emailSubject;
@Column(name = "email_content")
@Type(type = "org.hibernate.type.TextType")
private String emailContent;
public EmailTemplateCustomId getId() {
return id;
}
public void setId(EmailTemplateCustomId id) {
this.id = id;
}
public Tenant getTenant() {
return tenant;
}
public void setTenant(Tenant tenant) {
this.tenant = tenant;
}
public String getEmailSubject() {
return emailSubject;
}
public void setEmailSubject(String emailSubject) {
this.emailSubject = emailSubject;
}
public String getEmailContent() {
return emailContent;
}
public void setEmailContent(String emailContent) {
this.emailContent = emailContent;
}
}
Error
D:\github\spring_jwt\src\main\java\com\example\BLModel\EmailTemplateCustom.java:29:11
java: cannot find symbol
symbol: method type()
location: @interface org.hibernate.annotations.Type
CodePudding user response:
See the migration guide for Hibernate 6.0 to understand what you have to change in your code. In this particular case, you have to replace the @Type
annotation with @JdbcTypeCode(SqlTypes.LONGVARCHAR)