Last active
July 3, 2019 11:36
-
-
Save CedricL46/04570c1f078583321ad680ee8ba28f72 to your computer and use it in GitHub Desktop.
See full tutorial here : https://cedricleruth.com/how-to-programmatically-commit-or-rollback-a-transaction-in-oracle-adf/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static ViewObjectImpl getViewObjectFromIterator(String nomIterator) { | |
ViewObjectImpl returnVO = null; | |
DCBindingContainer dcb = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry(); | |
if (dcb != null) { | |
DCIteratorBinding iter = dcb.findIteratorBinding(nomIterator); | |
if (iter != null) { | |
returnVO = (ViewObjectImpl)iter.getViewObject(); | |
} | |
} | |
return returnVO; | |
} | |
private void commitIterator(String IteratorName) { | |
ViewObject vo = this.getViewObjectFromIterator(IteratorName); | |
try { | |
vo.getApplicationModule().getTransaction().validate(); | |
vo.getApplicationModule().getTransaction().commit(); | |
} catch (ValidationException e) { | |
String validationErrorMessage = e.getDetailMessage(); | |
//Occur when some committed data is rejected due to validation error. | |
//log it : log(Level.WARNING, " " + validationErrorMessage); | |
} | |
catch (Exception e) { | |
//Log it and warn something unexpected occured | |
} | |
} | |
private void rollbackIterator(String IteratorName) { | |
ViewObject vo = this.getViewObjectFromIterator(IteratorName); | |
try { | |
vo.getApplicationModule().getTransaction().rollback(); | |
} catch (Exception e) { | |
//Log it and warn something unexpected occured | |
} | |
} | |
//In your action listener simply call the commit function as follow | |
//You can Find YOUR_ITERATOR_NAME the your PageDef Binding file in the Executables Column | |
//this.commitIterator("YOUR_ITERATOR_NAME"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment