Enterprise Java

Passivation and Activation of View Objects with Transient Attributes

Within passivation/activation cycle of application modules the framework passivates and activates view objects as well. Usually the framework saves information about VO’s state, current row, bind variables values and such. But not the data. The VO’s query is going to be re-executed and the data is going to be re-fetched after activation of the view object. In most cases the query execution is not performed during or right after the activation phase, but is deferred until the view object is really used. This behavior is quite logical. Let’s assume that our application consists of several pages representing data of different view objects. If we send requests to the server from the same page we are going to get VOs executed that are used on that page only. All other view objects, used on other pages, are going to be passivated and activated as well. But they are not going to be re-executed until we ask the framework to do that by navigating to the particular page. And that’s cool! It means that we don’t perform unnecessary query executions and we don’t waste our memory. But there are some cases when the framework performs VO’s query execution during the activation phase not bothering whether we really use the VO.

One of these cases is about using of transient VO’s attributes. The common recommendation is to not passivate such attributes. But sometimes transient attributes are used to store some custom data and passivation/activation mechanism is used as a convenient way to save this data and keep it alive. Be careful with this approach. If any values of transient attributes are passivated, then the framework will execute the query during the activation of the view object.

Let’s consider a sample application with two pages – Employees and Departments.

Screen Shot 2013-07-19 at 2.31.00 PM

We use read-only SQL-based view objects browsing data on both pages:

Screen Shot 2013-07-19 at 2.35.18 PM

Screen Shot 2013-07-19 at 2.36.18 PM

So all VO’s attributes are transient and we’re not going to passivate them. Application module pooling is disabled:

Screen Shot 2013-07-19 at 2.43.59 PM

Exploring the request sent from the Employees page with ODLA we can see the following:

Screen Shot 2013-07-18 at 6.55.10 PM

There is no any query execution within application module activation phase. The VEmployees query has been executed in prepare model phase as it was expected.

And now let us change the passivate parameter of one of the VDepartments attributes:

Screen Shot 2013-07-19 at 2.55.14 PM

I am going to start the application with the Departments page in order to get the VDepartments VO executed and after that navigate to the Employees page. Sending next requests from the Employees page (for example sorting the table) we are going to get the following picture:

Screen Shot 2013-07-18 at 6.32.44 PM

It is obvious that besides execution of VEmployees query the framework executes VDepartments as well. And VDepartments is executed during the activation of the application module. Do we really need that? We are wasting CPU resources for unnecessary query executions and wasting memory to store query collections of unused view objects. The framework demonstrates the same behavior for view objects that have any dynamic attributes and for master view objects with retain view link accessors set on. So, be aware of these features.

That’s it!
 

Eugene Fedorenko

I am a Senior Architect at Flexagon focusing on ADF and many other things.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Renan
10 years ago

Hello Eugene! Nice article.

I have one question, how do you get de ODLA to looks like that? Like, every action the framework does and its execution time, can you tell me a step-by-step to how to reach that screen?

Thanks in advance,

Best regards,
Renan.

Back to top button