Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How is rollback from managed bean code different from rollback from DataControll?

Mehdi EsteghamatianFeb 17 2017 — edited Feb 18 2017

hi,

I have table of data and a link on top in jsff in a task flow file which opens a popup dialog (af;dialog in a af:popup ) and it creates and inserts a new record of data as below:

pastedImage_0.png

| | public void createInsertNewAsset(PopupFetchEvent popupFetchEvent) { |
| | BindingContainer bindings = getBindings(); |
| | OperationBinding operationBinding = bindings.getOperationBinding("CreateInsert"); |
| | Object result = operationBinding.execute(); |
| | } |

| | public void createInsertNewAsset1(ActionEvent actionEvent) { |
| | BindingContainer bindings = getBindings(); |
| | OperationBinding operationBinding = bindings.getOperationBinding("CreateInsert"); |
| | Object result = operationBinding.execute(); |
| | } |

| | public void onDialogCancel(ClientEvent clientEvent) { |
| | // execute the method |
| | System.out.println("Method Start: onDialogCancel "); |
| | |
| | |
| | BindingContainer bindings = getBindings(); |
| | RichPopup popup = this.getPopup(); | |
| | popup.hide(); |

| | // rollback |
| | OperationBinding op= bindings.getOperationBinding("Rollback"); |
| | op.execute(); |

| | List errors = op.getErrors(); |

| | if (!errors.isEmpty()) |

| | { |

| | Exception ex = (Exception)errors.get(1); |

| | ex.printStackTrace(); |

| | } |
| | |
| | // get the current row for AST_ASSET table |
| | DCIteratorBinding astAssetsVOIterator = (DCIteratorBinding) bindings.get("AstAssetsVOIterator"); |
| | |
| | ViewObject assetsVO = astAssetsVOIterator.getViewObject(); |
| | |
| | // repopulate the asset list |
| | assetsVO.executeQuery(); |
| | System.out.println("Method End: re execute was successful! "); |
| | System.out.println("Method End: onDialogCancel "); |
| | } |

An then I have defined a af:clientListener and a af:serverListener to handle cases where user decides to cancel the operation which is taken care by "onDialogCancel" method above.

pastedImage_0.png

But, in practice when I cancel the operation:

  1. if I use the escape button the onDialogCancel method is not called.

  2. if I use the close button on top-left corner, it leaves a blank row bcuz of the createInsert from the popupFetchListener although the bound java code calls the rollback. The other point is that if I drag and drop a rollback operation from the DataControl windows it does the exact job for me so I assume there is difference between how it is done in onDialogCancel and how the DataControl => Rollback operation takes care of that.

I need to get a CRUD operation done successfully using ADF just as POC for a new charity project.

Your answers are really really appreciate it.

Regards,

J

This post has been answered by Timo Hahn on Feb 18 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 18 2017
Added on Feb 17 2017
6 comments
516 views