Oracle ADF新建或编辑行状态未提交返回的做法

参考原文:

9.5 Undoing Pending Changes to an Entity Using the Refresh Method

You can use the refresh(int flag) method on any Row to refresh pending changes it might have. The refresh() method's behavior depends on the flag that you pass as a parameter. The three key flag values that control its behavior are the following constants in the Row interface.

  • REFRESH_WITH_DB_FORGET_CHANGES forgets modifications made to the row in the current transaction and the row's data is refreshed from database. The latest data from database replaces data in the row regardless of whether the row was modified or not.

  • REFRESH_WITH_DB_ONLY_IF_UNCHANGED works just like REFRESH_WITH_DB_FORGET_CHANGES, but for unmodified rows. If a row was already modified by this transaction, the row is not refreshed.

  • REFRESH_UNDO_CHANGES works the same as REFRESH_WITH_DB_FORGET_CHANGES for unmodified rows. For a modified row, this mode refreshes the row with attribute values at the beginning of this transaction. The row remains in a modified state.

9.5.1 Controlling What Happens to New Rows During a Refresh

By default, any entity rows with New status that you refresh() are reverted back to blank rows in the Initialized state. Declarative defaults are reset, as well as programmatic defaults coded in the initDefaults() method, but the entity object's create() method is not invoked during this blanking-out process.

You can change this default behavior by combining one of the following two flags with one from the above section (using the bitwise-OR operator):

  • REFRESH_REMOVE_NEW_ROWS, new rows are removed during refresh.

  • REFRESH_FORGET_NEW_ROWS, new rows are marked Dead.

9.5.2 Cascading Refresh to Composed Children Entity Rows

You can cause a refresh() operation to cascade to composed child entity rows by bitwise-OR'ing the REFRESH_CONTAINEES flag with any of the valid flag combinations above. This causes the entity to invoke refresh() using the same mode on any composed child entities it contains.

核心代码:
            Row currentRow = getAM().getVO().getCurrentRow();
            if(currentRow!=null){
                currentRow.refresh(Row.REFRESH_FORGET_NEW_ROWS |Row.REFRESH_UNDO_CHANGES);
                Key key = currentRow.getKey();
                getAM().getVO().executeQuery();
                currentRow = getAM().getVO().getRow(key);
                if(currentRow!=null){
                    getAM().getVO().setCurrentRow(currentRow);
                }


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值