Creating a Basic Databound Page 3-19
EL expression used to bind the command button to the mergeSuppliersSuppliers
method.
Example 3–11 JSF Code to Bind a Command Button to a Method
af:commandButton actionListener={bindings.mergeSupplier.execute} text=mergeSupplier
disabled={bindings.mergeSupplier.enabled} id=cb1
3.6.3 What You May Need to Know About the Difference Between the Merge and Persist Methods
If when you created your session bean, you chose to expose the merge and persist methods for a structured object, then those methods appear in the Data Controls panel
and you can use them to create buttons that allow the user to merge and persist the current instance of the object. Which you use depends on whether the page will need
to interact with the instance once updates are made. If you want to be able to continue to work with the instance, then you need to use the persist method.
The merge methods are implementations of the JPA EntityManager.merge method. This method takes the current instance, copies it, and passes the copy to the
PersistenceContext . It then returns a reference to that persisted entity and not to
the original object. This means that any subsequent changes made to that instance will not be persisted unless the merge method is called again.
The persist methods are implementations of the JPA EntityManager.persist method. Like the merge method, this method passes the current instance to the
PersistenceContext . However, the context continues to manage that instance so
that any subsequent updates will be made to the instance in the context.
3.6.4 What You May Need to Know About Overriding Declarative methods
When you drop an operation or method as a command button, JDeveloper binds the button to the execute method for the operation or method. However, there may be
occasions when you need to add logic before or after the existing logic. JDeveloper allows you to add logic to a declarative operation by creating a new method and
property on a managed bean that provides access to the binding container. By default, this generated code executes the operation or method. You can then add logic before or
after this code. JDeveloper automatically binds the command component to this new method, instead of to the execute property on the original operation or method. Now
when the user clicks the button, the new method is executed. For more information, see the Overriding Declarative Methods section in the Oracle Fusion Middleware
Fusion Developers Guide for Oracle Application Development Framework.
3.7 Creating an Input Form