JBO-25014: RowInconsistentException

现象:

在ADF中新建或者更新数据的时候,进行连续的Commit操作,会出现JBO-25014异常

  

异常原因:

在 比较EO Cached Entity与数据库中的值的时候,出现不一致。也就是在ADF的Commit操作后,数据库中的数据被其他操作修改了,这种情况会出现在数据库端使用了 Trigger的时候;另一种情况是,EO中的Attribute使用了用户自定义的domain-type,该类型的equals()方法返回 false

Cause: The database value does not match the cached value for this entity object. This could happen when another user or operation has committed modifications to the same entity-row in the database. This exception can also be thrown if the equals() method on one of the domain-type attributes in the entity fails. 

 

解决方案:

1,如果EO有Attribute使用了domain-type,检查equals()方法;

2,如果数据库端使用了trigger,修改EO的 Refresh after update  属性;

3,使用vo.executeQuery同步Model层与数据库中的数据。

Action: Choose from the following options: 

  

 

Verify that another user or operation has not modified the same row in the database. If this entity has attributes of a domain type verify that the equals() method on these domains do not fail when comparing the existing cached value with the newly fetched value. 

For any attributes/columns that are updated by the database, modify the entity attribute definition by selecting Refresh after update on the Attribute Settings page of the Entity Object Wizard. 

Use view.executeQuery() frequently, especially after any operations that result in data being changed. 

 

 在eo中添加实现类,然后复写lock方法。

    public void lock() {
        try {
            super.lock();
        } catch (RowInconsistentException e) { 
            refresh(REFRESH_WITH_DB_ONLY_IF_UNCHANGED | REFRESH_CONTAINEES);
            super.lock();
        }
    }

 

你可能感兴趣的:(exception)