Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Inheritance 使用继承类型为join的Eclipselink历史策略_Inheritance_Jpa_Glassfish_History_Eclipselink - Fatal编程技术网

Inheritance 使用继承类型为join的Eclipselink历史策略

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

我想使用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(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,您的错误似乎不正确