我正在使用下面的 jar 来运行 jpa 程序,但出现异常:
hibernate-entitymanager-3.4.0.GA.jar
hibernate-annotations-3.4.0.GA.jar
hibernate-commons-annotations-3.3.0.ga.jar
hibernate-core-3.3.1.GA.jar
javax.persistence.jar
例外是:
org.hibernate.AnnotationException:@Temporal 只能在 java.util.Date 或 java.util.Calendar 属性上设置:asso_attrib_overrides.FulltimeEmployee.currentProjects。
我的实体:
@Entity
public class FulltimeEmployee extends Employee {
@ElementCollection
@CollectionTable(name="EMP_PROJECTS", joinColumns=@JoinColumn(name="MY_EMP_ID"))
@Temporal(TemporalType.DATE)
@MapKeyJoinColumn(name="THE_PROJECT_ID")
@Column(name="STARTDATE")
protected Map<Project, Date> currentProjects;
public Map<Project, Date> getCurrentProjects() {
return currentProjects;
}
public void setCurrentProjects(Map<Project, Date> currentProjects) {
this.currentProjects = currentProjects;
}