Tag Archives: ADF

oracle.jbo.InvalidAttrKindException


If you happen to get the following error while migrating from Jdeveloper 10g to 11g

</p>
<p>oracle.jbo.InvalidAttrKindException: JBO-27034: Invalid kind for attribute &lt;a href=&quot;http://oracle.jbo.invalidattrkindexception/&quot;&gt;&lt;Attribute&lt;/a&gt; Name&gt; from the corresponding superclass attribute.<br />
at oracle.jbo.server.AttributeDefImpl.setBaseDefObject(AttributeDefImpl.java:688)<br />
at oracle.jbo.server.ViewAttributeDefImpl.setBaseDefObject(ViewAttributeDefImpl.java:311)<br />
at oracle.jbo.server.ViewDefImpl.resolveAttrs(ViewDefImpl.java:6537)<br />
at oracle.jbo.server.ViewDefImpl.resolveDefInternal(ViewDefImpl.java:5606)<br />
at oracle.jbo.server.ViewDefImpl.loadFromXML(ViewDefImpl.java:3856)<br />
at oracle.jbo.server.ViewDefImpl.loadFromXML(ViewDefImpl.java:3360)<br />
at oracle.jbo.server.ViewDefImpl.loadFromXML(ViewDefImpl.java:3308)<br />
at oracle.jbo.server.MetaObjectManager.loadFromXML(MetaObjectManager.java:527)<br />
at oracle.jbo.mom.DefinitionManager.loadLazyDefinitionObject(DefinitionManager.java:956)<br />
at oracle.jbo.mom.DefinitionManager.findDefinitionObject(DefinitionManager.java:482)<br />
at oracle.jbo.mom.DefinitionManager.findDefinitionObject(DefinitionManager.java:414)<br />
at oracle.jbo.mom.DefinitionManager.findDefinitionObject(DefinitionManager.java:396)<br />
at oracle.jbo.server.MetaObjectManager.findMetaObject(MetaObjectManager.java:749)<br />
at oracle.jbo.server.ViewDefImpl.findDefObject(ViewDefImpl.java:680)<br />
at oracle.jbo.server.ViewLinkDefImpl.resolveReferences(ViewLinkDefImpl.java:889)<br />
at oracle.jbo.server.ViewLinkDefImpl.findDefObject(ViewLinkDefImpl.java:129)<br />
at oracle.jbo.server.ViewDefImpl.resolveViewLinkAccessorAttribute(ViewDefImpl.java:7471)<br />
at oracle.jbo.server.ViewDefImpl.processViewLinkAccessors(ViewDefImpl.java:7653)<br />
at oracle.jbo.server.ViewDefImpl.processAccessors(ViewDefImpl.java:7462)<br />
at oracle.jbo.server.ViewDefImpl.getAttributeDefImpls(ViewDefImpl.java:733)<br />
at oracle.jbo.server.ViewObjectImpl.initViewAttributeDefImpls(ViewObjectImpl.java:8355)<br />
at oracle.jbo.server.ViewObjectImpl.getAttributeCount(ViewObjectImpl.java:6241)<br />
at oracle.jbo.server.ViewRowSetImpl.ensureStorage(ViewRowSetImpl.java:6520)<br />
at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:1061)<br />
at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:1299)<br />
at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:1217)<br />
at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:1211)<br />
at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:6097)</p>
<p>

means there is a problem in your data model

  • one of your View Objects extends a superclass View Object,
  • you extend one of the View Object attributes,
  • you define a different type for the extended attribute in the Base and the Superclass VO, ex. Persistent versus Calculated/Transient kind

SOA – a quick view


What is SOA?

SOA is standard based method of system development and integration

What are the benefits?

  • Reusability
  • Integration
  • Interoperability
  • Agile development
  • Scalability
  • Cost Efficient

What are all the ways to implement services?

  • Point to point approach
  • Vendor specific implementation
  • CORBA
  • Web services
  • SCA-style implementation

What are Services?

  • Building blocks of SOA
  • Interface and message structure definitions
  • Standard protocol for interoperability

What are SOA standards?


What is SCA [Service Component Architecture]?

SCA provides a programming model for building applications using SOA

What are the difference between SOA and SCA?

  • SOA is an approach or implementation style and SCA uses SOA to build a composite application
  • SOA is architectural style but SCA is assembly model and defines/design

What are the elements of SCA?

What is SDO [Service Data Object]?

  • Representation of data source in XML format and specifes methods to create, delete and modify data
  • Simplify and unify the way in which applications handles the data

What is EDN [Event Driven Network]?

  • To handle asynchronous messaging arising from a business event
  • Supports publish and subscribe model
  • Aligns with Event driven Architecture [EDA]



Right Align af:column footer


How to right align text in the af:column footer?

<f:facet name="footer">
 <trh:tableLayout width="100%">
 <trh:rowLayout width="100%">
 <trh:cellFormat width="100%" halign="end">
 <af:outputText value="outputText6"/>
 </trh:cellFormat>
 </trh:rowLayout>
 </trh:tableLayout>
 </f:facet>

How to get reference to currentRow for af:table


to get the current row, using the TableIterator as the executable


#{bindings.TableIterator.rangeStart+bindings.TableIterator.currentRowIndexInRange+1}

How to add FavIcon to the ADF page


I bet this is a common question among ADF developers who wish to have their own favicon for their page

Please follow the steps to achieve the same

add the following facet to the af:document tag of your adf page

<af:document id="d1">
..
..
..
<f:facet name="metaContainer">
 outputText escape="false"
 value='png" href="#{facesContext.externalContext.requestContextPath}/favicon.ico">' id="o1"/>
 </f:facet>
</af:document>


please note that the favicon specified in the value attribute in the outputext should be in the root-level of your web application

How to check pending changes in the page when browser back button is clicked


set the following property in the af:document tag of your page

<af:document id="d1" uncommittedDataWarning="on">

uncommittedDataWarning - Specifies whether users should be warned about uncommitted data when navigating off the page or region. Setting this property to ‘on’ will enable the warnings.
we can also call

ViewPortContext.isDataDirty();

to check for any uncommitted data

JBO-27024: Failed to validate a row with key oracle.jbo.Key


How to defer the mandatory constraint?

The mandatory validation is a database constraint and you do not have any control over it in ADF. You will not have the validation execution tab for these kind of DB constraint validation if you want to defer it based on some condition.But the Error message can be overridden.

if you want to populate the key attribute for the child from the parent then enable “Composite Association -> Cascade Update Key Attributes” for the association

JBO-27024: Failed to validate a row with key oracle.jbo.Key usually occurs

1. Not providing value for a mandatory attribute.
2. Incorrect value for an attribute of different data type
3. any of your other validation rules failed.

the validation is failing because the id attribute may not be getting created properly. Because of this it could not validate the row as the id is null. row.validateEntity() will help to identify the error by calling it when you commit the record and check where exactly the error pops up.

4. when the primary key is not based on a sequence and depends on the composite. The solution is to create a surrogate key. If you want to override the db constraint you must have a surrogate key populated programmatic way every time a new row is created. So that the data is unique all the time and proceed with a customized error message for each attribute, make the surrogate key hidden and read only.

if you want to suppress the validation then use skipValidation=true in pageDef or have the immediate set to true.

Adding custom message in ADF UI


The complete steps are given here

http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcadvgen.htm#BABEFGCI

also download the sample from here

Getting the value of Saved search – programatic way


QueryModel qm = (QueryModel)evaluateEL("#{bindings.SearchViewCriteriaQuery.queryModel}");
 for(int indexCount=0; indexCount
 {
 QueryDescriptor qd = qm.getUserQueries().get(indexCount);
 if(qd!=null){
 String queryDescriptorName = qd.getName();
 System.out.println(queryDesctiptorName);
 m = qd.getUIHints();
 isDefault = (Boolean) m.get(QueryDescriptor.UIHINT_DEFAULT);
 System.out.println(isDefault);
 isRunAutomatically = (Boolean) m.get(QueryDescriptor.UIHINT_AUTO_EXECUTE);
 System.out.println(isRunAutomatically);
 if (Boolean.TRUE.equals(isDefault) && Boolean.TRUE.equals(isRunAutomatically){
 break();
 }
 else{
 queryDescriptorName = null;
 }
 System.out.println(isDefault);
 }

Snippet to check if the transaction is dirty


We can use the following code snippet to check if the transaction is dirty or not

BindingContext bctx = oracle.adf.controller.binding.BindingUtils.getBindingContext();
if (bctx.findDataControlFrame(bctx.getCurrentDataControlFrame()).isTransactionDirty()) {
 //show the timestamp
 }
 else{
 //don't show
 }