我正在尝试在我的 Employee 实体中关联一个函数列表(可嵌入),而 H2 似乎对它期望一个“标识符”的说法不满意
引起:org.h2.jdbc.JdbcSQLException:SQL 语句中的语法错误“CREATE TABLE EMPLOYEE_FUNCTIONS (EMPLOYEE_EMPLOYEEID VARCHAR(255) NOT NULL, ACTIVE BOOLEAN NOT NULL, DEPARTMENTNUMBER INTEGER NOT NULL, DESCRIPTION VARCHAR(255), ORDER[*] INTEGER非空)"; 预期的“标识符”;
问题是我已经在另一个项目中做到了这一点,但我不明白为什么它不起作用。
雇员.java
@Entity
public class Employee extends AbstractScheduleEntity<EmployeeSchedule> {
public static final String ACOMBA_UNIQUE_FIELD = "acombaUnique";
@Id
@GenericGenerator(name = "sequence_id", strategy =
"ca.tecsar.core.sql.ServerSequenceGenerator")
@GeneratedValue(generator = "sequence_id")
@Column(name = "EmployeeID", unique = true, nullable = false)
private String employeeID;
@ElementCollection
private List<Function> functions;
//getter and setter
}
函数.java
@Embeddable
public class Function implements Serializable {
private int order;
private boolean active;
private String description;
private int departmentNumber;
//getter and setter
}
我删除了 Employee 中一些不必要的属性。什么可能导致此错误?是因为我的员工中有一个字符串作为标识符吗?如果是这样,我如何告诉 Hibernate 添加 Employee_EmployeeID 作为标识符?谢谢