Friday, April 7, 2017

Workaround for ADF BC View Object Attribute Order Problem in JDeveloper 12c

I'm sure probably every ADF developer sooner or later faced this issue. When you create VO based on EO, JDEV gives you alphabetically ordered list of attributes. As a result - order of attributes in EO and VO becomes different. While this doesn't influence runtime functionality, it becomes quite annoying for application maintenance. Hard to match attributes between VO and EO, developer need to search through the list to locate attribute he is looking for. But there is a workaround, I will describe it here.

Let's see what the problem first. Assume we have Employees EO, attributes are generated in the same order as DB table columns:

Now if you are using VO creation wizard, list of attributes will be displayed in alphabetic order. This is frustrating:

Without any other choice, developer would select EO attributes and select them in such order as it is listed:

But wait, there is a workaround. Don't select all attributes, instead select only EO item itself. Then use Add button to add entire list of EO attributes:

This time attributes will be added in original order, as the order is set in EO.

Enjoy this small, but useful hint.

No comments: