Skip to main content

Posts

Showing posts from June, 2010

Manually Assign new value to sequence column

Sometime we need to manully assign a new value to a sequence column. For example, we have a department table with primary key column department_id, which is based on a sequence "department_sequence". When we try to create a new record in the department table, we will do the following in the AMImpl.java: ************************************************************* DepartmentVOImpl vo = getDepartmentVOImpl(); vo.clearCache(); Row row = vo.createRow(); SequenceImpl sequence = new SequenceImpl("department_sequence, getDBTransaction()); Number dept_id = sequence.getSequenceNumber(); row.setAttribute("DepartmentId", dept_id); //set other attribute values... vo.insertRow(row); getDBTransaction().commit(); *************************************************************

Post Ordering Issue

I have a previous post  about the post ordering constraints error. The situation in that post might be somewhat special: the association between two entity objects (master and detail) is a DBSequence in the master table. Here is a working solution to the generic post ordering issue. Steve Muench has an article " Forcing a New Dept to Post Before a New Emp Without Composition ", which presented two ways to solve the post ordering contraints: 1. Override postChanges() method in the detail/child entity object Implementation java file. For example, if Dept and Emp table, then write below codes in EmpImpl.java file: 2. An even simpler way: Steve also has a very good article on " Most Commonly Used Methods in ADF Business Components " which lists all common used methods in EO, VO, AM, etc.

Setup SSL Certificate for PayFlow Gateway in Weblogic 10.3

PayFlow Pro is a gateway provided by PayPal Inc for payment transactions, like credit card transaction. To use payFlow gateway in ADF application, you have to install the payFlow SDK from Paypal. You can find info in here . After installation of payFlow processor you can download the payflow Java Library and write codes to process the transaction. But before that, you have to set up the SSL on your server to make it work. The SSL is installed on your development server to recognize the PayFlow's transaction process server, therefore the SSL has to be installed into the trust keystore on the weblogic server. For test and development purpose, the SSL certificate can just added to the default existing keystore in Weblogic server. The steps are here: 1. download the SSL certificate that can recognize PayFlow server. It can be downloaded from either A or C link.The download link is here . 2. Use keytool command to import the certificate into the existing trust keystore for dev

Implement Cascading lists of values in ADF 11g

In many cases, we will have to use cascading lists of values, also called dependent lists of values in our ADF application. Cascading lists of values, in its name, means one set of list of values are dependent on selected value on  another set of list of values. How does it work is apply view criteria to a model driven list of value . Here I present one example in HR schema. Let's say we have a list of departments, when one department value is selected, a second list of values - manager will be set to managers within the selected departments, a third list of values - employees will be set to employees under the selected manager. First, we create our base VO - EmployeesVO (can be created from Entity object also) Second, we create 3 list of values for 3 attributes we are interested in EmployeesVO: DepartmentId, ManagerId, EmployeeId. Each list of value needs a view accessor (data source for the LOV).  DepartmentId attribute needs a view accessor from DeptListVO, which is bas

Build Custom Search in ADF 11g

Although ADF 11g provides us with declarative search component for a search functionality, in many cases it still cannot satisfy the business requirements. Here I am presenting a way to build a custom search page without using build-in search component in ADF 11g. This example was built under HR schema to search employees using tables: employees, departments, jobs, locations, countries. Normally, we will catch the user input in managed beans and send the user input back to our model, and explicitly run the executeQuery() against the iterator that binds to the results table. here I did something differently.... I am using another VO with transient attributes to catch the search criteria user inputs, and send these inputs into the VO iterator which binds the search results table. So when user inputs search criteria, the changes will retain in a VO Row and I will user getter method to catch the changes and send the changes to the VO that I can run executeQuery() to do the search. To