如何解决“原因:java.lang.IllegalArgumentException:对象:null不是已知的实体类型。”运行1小时后出现错误

时间:2019-09-27 07:18:35

标签: java jpa ejb oracle-adf

页面运行70分钟后,在我的视图中运行主迭代器,绑定正在刷新并抛出以下异常 “ java.lang.IllegalArgumentException:对象:null不是已知的实体类型。”

我已经尝试将迭代器的refresh属性更改为never,并且仍然刷新。

这是我的实体

@Entity
@NamedQueries({ @NamedQuery(name = "Employees.findById", query = "select o from Employees o where o.employeeId = :employeeId")})
public class Employees implements Serializable {
    @Id
    @Column(name = "EMPLOYEE_ID", nullable = false)
    private Integer employeeId;
    private Integer salary;
    public Employees() {
    }

    public Integer getEmployeeId() {
        return employeeId;
    }

    public void setEmployeeId(Integer employeeId) {
        this.employeeId = employeeId;
    }

    public Integer getSalary() {
        return salary;
    }

    public void setSalary(Integer salary) {
        this.salary = salary;
    }

}

这是我的会话bean

@Stateless(name = "HrFacade", mappedName = "Hr_EJB_JPA-Model-HrFacade")
public class HrFacadeBean implements HrFacade, HrFacadeLocal {
    @Resource
    SessionContext sessionContext;
    @PersistenceContext(unitName = "Model")
    private EntityManager em;

    public HrFacadeBean() {
    }

    public Employees mergeEmployees(Employees employees) {
        return em.merge(employees);
    }

    public Employees getEmployeeByDepEmpId(Integer employeeId){
        if(employeeId != null){
            return em.createNamedQuery("Employees.findById",Employees.class)
                 .setParameter("employeeId", employeeId)
                 .getResultList().get(0);
        }
        return new Employees();
    }

这是我的绑定

<?xml version="1.0" encoding="UTF-8" ?>
<pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel" version="12.2.1.16.48" id="view1PageDef"
                Package="oracle.view.pageDefs">
  <parameters/>
  <executables>
    <variableIterator id="variables"/>
    <iterator Binds="root" RangeSize="25" DataControl="HrFacadeBean" id="HrFacadeBeanIterator"/>
    <accessorIterator MasterBinding="HrFacadeBeanIterator" Binds="employeeByDepEmpId" RangeSize="25"
                      DataControl="HrFacadeBean" BeanClass="oracle.model.Employees" id="employeeByDepEmpIdIterator"/>
  </executables>
  <bindings>
    <attributeValues IterBinding="employeeByDepEmpIdIterator" id="employeeId">
      <AttrNames>
        <Item Value="employeeId"/>
      </AttrNames>
    </attributeValues>
    <attributeValues IterBinding="employeeByDepEmpIdIterator" id="salary">
      <AttrNames>
        <Item Value="salary"/>
      </AttrNames>
    </attributeValues>
    <methodAction id="employeesMerge" RequiresUpdateModel="true" Action="invokeMethod" MethodName="mergeEmployees"
                  IsViewObjectMethod="false" DataControl="HrFacadeBean"
                  InstanceName="data.HrFacadeBean.dataProvider"
                  ReturnName="data.HrFacadeBean.methodResults.employeesMerge_mergeEmployees_dataControl_dataProvider_mergeEmployees_result">
      <NamedData NDName="employees" NDValue="#{bindings.employeeByDepEmpIdIterator.currentRow.dataProvider}"
                 NDType="oracle.model.Employees"/>
    </methodAction>
  </bindings>
</pageDefinition>

这是我的页面绑定

<?xml version="1.0" encoding="UTF-8" ?>
<pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel" version="12.2.1.16.48" id="untitled2PageDef"
                Package="oracle.view.pageDefs">
  <parameters/>
  <executables>
    <variableIterator id="variables"/>
    <taskFlow id="taskflow11" taskFlowId="/WEB-INF/task-flow-1.xml#task-flow-1" activation="conditional"
              xmlns="http://xmlns.oracle.com/adf/controller/binding"
              RefreshCondition="#{pageFlowScope.employeeId ne null}" active="#{pageFlowScope.employeeId eq null}">
      <parameters>
        <parameter id="employeeId" value="1212"/>
      </parameters>
    </taskFlow>
  </executables>
  <bindings/>
</pageDefinition>

我可以正常合并我的工作,直到1小时10分钟为止,迭代器正尝试刷新以通过getEmployeeByDepEmpId进行操作,并且它将引发异常,所以有人会知道为什么迭代器具有此行为以及如何更改它?预先谢谢你。

0 个答案:

没有答案