Monday, May 8, 2017

Could not commit when auto commit set on ADF Glassfish Server

Hi All,

In our recent project we have faced one strange issue that is when we try to commit the data using Application Module commit operation Its throwing could not commit when auto commit set on. The same is working fine in Weblogic. We have deployed the same application in glassfish server but suddenly this popup is getting launched.

The solution for this issue is just server configuration change. Open JDBC in glassfish console and set Non-Transactional connections as checked. Thats it the problem will be resolved. 

Set Non-Transactional Connections >> true.

Happy Learning....

Dotted lines on PanelBox or Buttons or Links in ADF

Hi All,

In our recent project we faced the skinning issue especially in Chrome Browser. We have a panelbox which contains links. When we click on any link rectangular box is coming like this.

Solution is very straight forward just need to add this single line for all the components for which box is coming.

i.e, outline: none;

Now if you add this line you will not get any dotted lines.

Thursday, September 1, 2016

After Commit extra empty rows are getting created

Recently In our project we came to a strange  situation where if user is creating new rows and committing the data to database. After commit operation its creating empty rows (count is equal to newly created rows).

Its because of one Entity instance data has been shared by multiple VO instancces.

This is a strange behavior of ADF VO. the reason behind this behavior is data shared between VO instances like if there were multiple instances of the same VO i.e, iterators data shared between those iterators.

the solution is straight forward, like it can be done at 2 levels. Like 1. Application Module Level

2. VO Impl class Level.

1. Application Module:

If we want to apply this at all view objects of the application. Then we can go for this option.

In application module we have a property jbo.viewlink. consistent . the default vlaue is true (DEFAULT) we need to change this property to false as shown in below image. B

2. VO Impl class Level:

In VO Impl we need to override the rowQualifies life cycle method. To display the rows which are not modified.

    protected boolean rowQualifies(ViewRowImpl viewRowImpl){
        EntityImpl primaryEntity = viewRowImpl.getEntity(0);
        if(primaryEntity !=null && primaryEntity.getEntityState()!=Entity.STATUS_UNMODIFIED){
            return false;
        return super.rowQualifies(viewRowImpl);

that's it Its working simple tip but saved lot of time. It might be helpful to you.

Thursday, December 17, 2015

varStatus variable in ADF table

There is an inbuilt feature in ADF table called varStatus variable, which can be used to display a auto increment number for any dummy column in adf page.

Suppose if there is a requirement to display serial numbers in adf page for each row, we can create a column name and use the varStatus attributes index method to achieve this.

Step1: In af:table source add the variable varStatus like this.

<af:table value="#{bindings.DepartmentsView1.collectionModel}" var="row"                         
                         varStatus = "vs" >

Step2: add a dummy column Serial Number to the table like this.

<af:column id="c5" headerText="Serial Number"/>

Step3: add output text component in the above column like this. and Make the value attribute to the vs.index+1. first vs.index will have value 0 . So from there we are increment by 1.

<af:column id="c5" headerText="Serial Number">
 <af:outputText value="#{vs.index+1}" id="ot1" />

Step4: Run the page you will get the following output.

but if you want to access this varStatus value from a managed bean you wont access as the documentation says that the value will be lost once its rendering.

An alternate approach to get the value of varStatus is getting the row index. 

we can Get the row index  by following code

  1. RowKeySet selectedEmps = getTable().getSelectedRowKeys();  
  2.     Iterator selectedEmpIter = selectedEmps.iterator();  
  3.     DCBindingContainer bindings = (DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry();  
  4.     DCIteratorBinding empIter = bindings.findIteratorBinding("EmployeesView1Iterator");  
  5.     RowSetIterator empRSIter = empIter.getRowSetIterator();  
  6.     while (selectedEmpIter.hasNext())  
  7.     {  
  8.       Key key = (Key) ((List);  
  9.       Row currentRow = empRSIter.getRow(key);  
  10.       System.out.println("Row Index= " + (empIter.getViewObject().getRangeIndexOf(currentRow) + 1));  
  11.     }  

Cheers... keep learning... 


Thursday, November 12, 2015

Disable Full Page Refresh on Button Click in ADF

If in our application there is a command button on clicking on that command button the page is refreshing totally and loading the page.

If we dont want this full page refresh then we have to make a small change i.e. set partialSubmit to true for that command button. It will not refresh entire page.

Tuesday, July 22, 2014

Select Many Choice use in ADF

Hi All, if we want to select multiple values from the list box then we will make use of inbuilt component "af:selectmanychoicebox" in ADF. follow these steps to use this component.

Step1: Create view object for example I have created "DepartmentsVO"

Step2: make an attribute as lov from "DepartmentsVO"

Step3:  create one jspx page and add List binding in page definition as shown below

Step 4: from component pallete select "Select Many Choice component" and it will ask for bindings add bindings like below and click on ok

Step 5: Run the page you will get the output like this

Friday, July 18, 2014

Adding Validation to the Criteria in ADF

Hello Guys if you want to add validation to the input text fields of the Criteria please follow the steps.

Step1: Create a view Criteria as shown below


Drop this named criteria from data controls to a page as Query Panel


Drop the View Object as form on the same page

Step4: add Partial Target of the form to Criteria

Step5: Select af:Query Component in Structure window and change the query listner property from Property Inspector as shown below(Default query Listner value is: #{bindings.EmployeesEOViewCriteriaQuery.processQuery} ) save this value which needs to be used in bean class


write the following code in the bean class:

package com.test.beans;


import javax.el.ELContext;
import javax.el.ExpressionFactory;
import javax.el.MethodExpression;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCDataControl;
import oracle.adf.model.binding.DCIteratorBinding;

import oracle.binding.BindingContainer;

import oracle.jbo.ApplicationModule;
import oracle.jbo.server.ViewObjectImpl;

public class FormValidate1 {
    public FormValidate1() {

    public void customQueryListner(QueryEvent queryEvent) {     // Add event code here...
       String fname = null;
        String lname = null;
        BindingContext ctx = BindingContext.getCurrent();
        BindingContainer cont = ctx.getCurrentBindingsEntry();
        DCIteratorBinding dci = (DCIteratorBinding) cont.get("EmployeesEOView1Iterator");
        ApplicationModule am  = dci.getDataControl().getApplicationModule();
        //ApplicationModule am  = dci.getDataControl().
       //  ApplicationModule am  = dci.geta
        DCDataControl dc = ctx.findDataControl("TestAMDataControl");
        TestAMImpl ta =(TestAMImpl) dc.getApplicationModule();
        ViewObjectImpl voi = (ViewObjectImpl)dci.getViewObject();
        fname = (String)voi.getNamedWhereClauseParam("bFirstName");
        lname = (String)voi.getNamedWhereClauseParam("bLastName");
        if(fname.length() >4) {
        FacesContext.getCurrentInstance().addMessage(null,new FacesMessage("Name should not be lessthan 4 charecters"));
        else if(am.getTransaction().isDirty()) {
            FacesContext.getCurrentInstance().addMessage(null,new FacesMessage("Please Save the changes or Undo Them"));
         String el = "#{bindings.EmployeesEOViewCriteriaQuery.processQuery}";
            invokeEL(el, new Class[]{QueryEvent.class}, new Object[]{queryEvent});
           // invokeEL(el, null,  new Object[]{queryEvent});
    public static Object invokeEL(String el,Class[] paramtypes, Object[] params) {
        FacesContext cont = FacesContext.getCurrentInstance();
        ELContext elcont =  cont.getELContext();
        ExpressionFactory ef = cont.getApplication().getExpressionFactory();
        MethodExpression exp = ef.createMethodExpression(elcont, el, Object.class, paramtypes);
        return exp.invoke(elcont, params);

Run the application and give charecters for firstname more than 4 you will get error message.

Could not commit when auto commit set on ADF Glassfish Server

Hi All, In our recent project we have faced one strange issue that is when we try to commit the data using Application Module commit oper...