Showing posts with label Alternate Key. Show all posts
Showing posts with label Alternate Key. Show all posts

Wednesday, 19 June 2013

ADF : Disable and Enable TableSelectionListener

Some times in the development we need to enable or disable the table so that the user is not able to make row selection from the table.
Suppose there is a case in which a row selected in the table is in edit mode in a form, and you don't want to allow the user to select any other row during the edit operation. So for this purpose you need to disable the table selection.
You can use the following code for doing so :



tableBinding.setRowSelection(RichTable.ROW_SELECTION_NONE);

Here :
  1.  "tableBinding" is the binding of table in the bean. 
And after your work when you want to again enable the rowSelection. You can use it as follows :
tableBinding.setRowSelection(RichTable.ROW_SELECTION_SINGLE);

Tuesday, 7 May 2013

ADF : To implement duplicate record validation form Entity Object (EO)

Most of the time we need to make sure that no duplicate value should exist in database. For example you are making an entry in the employees table in HR schema you dont want that no two employees have same First name. So, in ADF you can eaisly implement this validation. You just have to put an integrity constraint in the EO and simply give the message that you want to show when the user enters duplicate employee name.

  1. Create a Fusion Web Application(ADF) in JDeveloper. And create connection to the database. And then create a taskflow and then drag an view from component pallate and then give it a name and create a jsff page.
  2. Then right click on the model and then create business components from tables. And then select the employee table and create VO and EO and add the same in AM.
  3. Now select EmployeeEO and in "General" tab add an alternate key with "First Name" column, then go to "Business Components". And then select "Entity Validators" and click on Add button. And choose Unique key in "Rule Definetion". Then go to the another tab in the popup "Failure handeling" and write the message that you want to show when duplicate record is found.


  4. Then just go to the jsff page and then then create a form from the table that comes shows in Datacontrol. Then just add "createInsert" and "commit" button from the operations in datacontrol.
  5. Then create a jspx page in viewController and drag the taskflow in it and right click and run the page. Click on createInsert button and enter a name in First Name that already exists and then click Commit. Then the error will come up at First name field.


    You can download sample app here. DuplicateRecordCheck.rar
    Simply download and unrar it and the run it in JDeveloper.