Inheritance 使用继承类型为join的Eclipselink历史策略
我想使用eclipse链接历史将以下内容镜像到类Inheritance 使用继承类型为join的Eclipselink历史策略,inheritance,jpa,glassfish,history,eclipselink,Inheritance,Jpa,Glassfish,History,Eclipselink,我想使用eclipse链接历史将以下内容镜像到类 @Entity @Table(name="EMPLOYEE") @Inheritance(strategy= InheritanceType.JOINED) @TableGenerator(name="Employee_Gen", table="ID_GEN", pkColumnName="GEN_NAME", valueColumnName="GEN_VAL", pkColumnValue="Employee_Gen") @Customizer
@Entity
@Table(name="EMPLOYEE")
@Inheritance(strategy= InheritanceType.JOINED)
@TableGenerator(name="Employee_Gen", table="ID_GEN", pkColumnName="GEN_NAME", valueColumnName="GEN_VAL", pkColumnValue="Employee_Gen")
@Customizer(EmployeeCustomizer.class)
public class Employee implements Serializable {
}
@Entity
@Table(name="COMMESSIONEMPLOYEE")
public class CommesionEmployee extends Employee {
}
我的历史记录表在哪里
@Entity
@Table(name="EMPLOYEE_HISTORY")
@IdClass(EmployeeHistoryId.class)
@Inheritance(strategy= InheritanceType.JOINED)
public class EmployeeHistory implements Serializable {
}
@Entity
@Table(name="COMMISSIONEMPLOYEE_HISTORY")
public class CommesionEmployeeHistory extends EmployeeHistory {
}
定制器类是
public class EmployeeCustomizer implements DescriptorCustomizer {
@Override
public void customize(ClassDescriptor cd) throws Exception {
HistoryPolicy policy = new HistoryPolicy();
policy.addStartFieldName("MJSTART");
policy.addEndFieldName("EMPLOYEE.MJEND");
//policy.addEndFieldName("COMMISSIONEMPLOYEE.CEEND");
policy.addHistoryTableName("EMPLOYEE","EMPLOYEE_HISTORY");
//policy.addHistoryTableName("COMMISSIONEMPLOYEE","COMMISSIONEMPLOYEE_HISTORY");
policy.setShouldHandleWrites(true);
cd.setHistoryPolicy(policy);
}
}
当前没有任何内容写入CommenceEmployee_历史记录表。我做错了什么
P、 S>如果我对类EmployeeHistory使用单表进行继承,则不会将任何内容写入子类ComessionEmployeeHistory的属性。Odd
尝试自定义这两个类
public class EmployeeCustomizer implements DescriptorCustomizer {
@Override
public void customize(ClassDescriptor cd) throws Exception {
HistoryPolicy policy = new HistoryPolicy();
policy.addStartFieldName("MJSTART");
policy.addEndFieldName("MJEND");
policy.addHistoryTableName("EMPLOYEE","EMPLOYEE_HISTORY");
policy.setShouldHandleWrites(true);
cd.setHistoryPolicy(policy);
}
}
public class CommesionEmployeeCustomizer implements DescriptorCustomizer {
@Override
public void customize(ClassDescriptor cd) throws Exception {
HistoryPolicy policy = new HistoryPolicy();
policy.addStartFieldName("MJSTART");
policy.addEndFieldName("MJEND");
policy.addHistoryTableName("COMMISSIONEMPLOYEE","COMMISSIONEMPLOYEE_HISTORY");
policy.setShouldHandleWrites(true);
cd.setHistoryPolicy(policy);
}
}
但是,还要记录一个bug,您的错误似乎不正确