Monday 23 November 2015

ORA-01446: cannot select ROWID from......... in ADF VO

I have search page - (af:querypanel  based on view criteria and result will be displayed in af:table) based on entity based VO and query contains union operation

My VO does not have primary key attribute so i have added ROWID from entity as a primary key.

When I run the page and hit on search button in the standard query panel, I was getting below mentioned error

ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc

From the on line resources I found that, either I have to remove ROWID or remove DISTINCT, GORUP By clause.

Solution I have did to overcome from this issue,

Since mine is search screen and does not involve any transactions so better approach would be to create query based VO(or Read only VO) instead of Entity based VO to avoid ROWID.

So, I have just re-shuffle the Selected Entity under "Entity Objects" in VO overview editor to convert entity based vo to read only or query based VO.

So, try to have one primary key attribute for your VO if it is entity based VO. If read only VO meets your requirement then go for it to avoid unnecessary errors.

Hope it helps :)

Saturday 21 November 2015

Programmatically executing View criteria in VOImpl in ADF

Below is the code snippet to execute view criteria in your VOImpl

ViewCriteria vc = this.getViewCriteriaManager().getViewCriteria("DeptVOCriteria");

//Manages named variables and their values.         
VariableValueManager vvm = vc.ensureVariableManager();

// Set bind parameter values  
 vvm.setVariableValue("bindDept", <dept value>);

//apeend View Criteria
this.appendViewCriteria(vc);

// Executing the query          
 this.executeQuery();