我的问题是我使用的 Hibernate 版本;当我运行 Hibernate 5 时,不再支持多个类和依赖项,例如 org.jadira.usertype、joda-time、Query 作为类或 SetString() 作为方法。
参考资料:
Resolving java.lang.AbstractMethodError, Error creating bean with name 'entityManagerFactory' in Spring
Migrating To Hibernate 5 from 3
添加了以下依赖,
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-java8</artifactId>
<version>5.4.2.Final</version>
</dependency>
我从 pom.xml 中删除了 org.jadira.usertype 、 joda-time 依赖项。但是,我的 POJOS/Spring Bean 被设计为使用这些依赖项,即使用 @DateTimeFormat 注释
@Entity
@Table(name = "APPLICANTS_EDUCATION")
public class ApplicantEducation implements Serializable{
private static final long serialVersionUID = 1L;
@Column(name = "EDUCATION_TITLE")
private String educationTitle;
@Column(name = "SCHOOL_NAME")
private String schoolName;
@NotNull
@DateTimeFormat(pattern = "DD/MM/YYYY")
@Column(name = "START_DATE", nullable = false)
@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDate")
private String startDate;
Annotation @Type 和对象类型已更改
@NotNull
@DateTimeFormat(pattern = "DD/MM/YYYY")
@Column(name = "START_DATE", nullable = false)
@Type(type = "org.hibernate.type.LocalDateTimeType")
private LocalDateTime startDate;
@DateTimeFormat(pattern = "DD/MM/YYYY")
@Column(name = "END_DATE")
@Type(type = "org.hibernate.type.LocalDateTimeType")
private LocalDateTime endDate;