下面是我的build.gradle文件
buildscript {
ext {
springBootVersion = '3.0.2'
springCloudVersion = '2022.0.0-M3'
}
...
implementation 'org.springframework.boot:spring-boot-starter-data-jpa:3.0.0'
implementation 'org.postgresql:postgresql:42.3.8'
implementation 'com.vladmihalcea:hibernate-types-55:2.20.0'
下面是我的实体类,
import com.vladmihalcea.hibernate.type.array.ListArrayType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.jackson.Jacksonized;
import org.hibernate.annotations.Type;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Jacksonized
@Table(name = "students_stored_row")
@Entity(name = "studentDAO")
public class StudentDAO {
@Id
private String id;
@Type(type = "list-array")
@Column(name = "course", columnDefinition = "text[]")
private List<String> courses;
private List<String> coursePath;
@Type(type = "jsonb")
private List<Address> address;
}
我最近将Spring Boot 版本升级为springBootVersion = '3.0.2',将休眠版本升级为'com.vladmihalcea:hibernate-types-55:2.20.0'。gradle-7.4.1。在运行./gradlew clean build时,我观察到以下错误,
error: cannot find symbol
@Type(type = "jsonb")
^
symbol: method type()
location: @interface Type
error: cannot find symbol
@Type(type = "list-array")
^
symbol: method type()
location: @interface Type
2条答案
按热度按时间ttcibm8c1#
现在您需要使用
value
参数和类来实现UserType
接口,如文档所示:https://docs.jboss.org/hibernate/orm/6.0/javadocs/org/hibernate/annotations/Type.htmlddrv8njm2#
试试这个: