21 Oct 2015

Passivation of Entity Transient Attributes

Everyone knows about VO transient attributes. In order to make them passivation/activation safe (capable of surviving AM passivation/activation cycle) we have to either select Passivate checkbox for each such transient attribute or select Passivate State and Including All Transient Values checkboxes for the entire view object. In that case the framework will save values of those transient attributes to the passivation storage during the passivation and read these values back during the activation. It's clear. But how about entity transient attributes? Very often this question gets ADF developers confused. There are not any "passivation" checkboxes available for the entity definition or entity attributes. Does it mean that entity transient attributes are not passivation/activation safe and their values are going to be lost during AM recycling?

Everything is going to be all right! The passivation of entities is switched on by design. The framework saves values of all dirty entity attributes to the passivation storage. This is true for transient attributes as well.
Let's assume there is DepartmentsEO entity with a transient attribute SomeTransAttribute. If value of this attribute is modified then the framework writes to the passivation storage the following structure:

      <EO Name="com.adfpractice.entitytransattrpassiv.model.entities.DepartmentsEO">
         <![CDATA[00010000000AACED000577040000000A]]>
         <DepartmentsEORow PS="2" Hdl="1">
            <SomeTransAttribute>
               <DATA>56</DATA>
               <ORIG_DATA null="true"/>
            </SomeTransAttribute>
         </DepartmentsEORow>
      </EO>
  
Actually, this is passivation data for the dirty entity instance and it contains value (56) of the modified transient attribute SomeTransAttribute.

That's it!

No comments:

Post a Comment

Post Comment