Search This Blog

Thursday, October 10, 2013

Search cannot be executed because the table has pending changes that would be lost

** We encounter with this problem when the VO associated to the table region is Dirty. That means there are some changes in the VO, but which are not committed(not saved in the database) or rollback. Usually we see this error when we have any Transient Attributes attached to  the VO.

For Example, In Master-Detail relationship, we use a transient attribute to display show/hide. This will create the issue.. 

Solution:
1. Go to your VORowImpl.java
2. Search for the method public void set<TransientAttributeName>(Boolean value)
3. In this method, replace setAttributeInternal(<TransientAttrName>, value) with
populateAttribute(<TransientAttributeName>,value)
4. Example: 
Transient Attribute Name: DetailFlag
Datatype: Boolean then
search for method public void setDetailsFlag(Boolean value)
Replace setAttributeInternal(DETAILFLAG, value) with
populateAttribute(DETAILFLAG,value)
5. Re-test the issue.

** When handling a user initiated search in your page, to fix this issue, try below solution:

In processFormRequest(), get handle on the table region that you have created.

OAAdvancedTableBean templateTblBean = (OAAdvancedTableBean)webBean.findChildRecursive("<Table RN Name>");
templateBean.queryData(pageContext,false);

2 comments:

  1. Thanks... i was facing same issue.. Its resolved. :-)

    ReplyDelete
  2. populateAttribute solved my problem. templateBean.queryData(pageContext,false) works also but it blocking pagination in query region

    ReplyDelete