Wednesday, June 3, 2015

Changing default entity object transient attributes to trusted mode programatically in ADF 12c .

Hello Dears,

Oracle has changed the transient attributes evaluation expression from trusted mode in ADF 11g

to untrusted in ADF 12c.

Therefore , when you are creating new transient attributes you will find the xml for the entity object

attribute having the trustMode="untrusted" by default as the following.

When the evaluation expression is untrusted you can not access some viewAccessor methods like

setNamedWhereClauseParam() or executeQuery() and so on..

To solve this issue here you are having two choices :-

1- Change the trustMode to trusted manually inside the source code for every single transient attribute in your application.

or simply

2- Use the following programmatic approach.

- Create an Extension EntityDefImpl class inside your application

- Register this ExtEntityDefImpl inside your application to be the parent class for every single entity

Def Impl you are having in your application with this way

- Override the method finishedLoading() with the following implementation.

Now regardless you have switched the trust mode to trusted inside the source xml manually or not

Your code is going to set the default mode to trusted mode , this will save huge amount of time

for you going through all your transient attributes and switch them one by one , thanks.

Hope it was a good idea , Mahmoud :)