Thursday, 7 January 2016

extend passivation snapshot with some extra data

Few things about passivation itself. I won't be much creative, quot from the docs 40.2.2:

An application module supports passivating (storing) its pending transaction state to an XML document, which is stored in the database in a single, generic table, keyed by a unique passivation snapshot ID. It also supports the reverse operation of activating pending transaction state from one of these saved XML snapshots. This passivation and activation is performed automatically by the application module pool when needed.
AM is passivating also such data like view criteria values, rows marked as current within iterators and much more. Data are passivated to the passivation store, by default to the PS_TXN database table. They can be stored also in a file and, depends on the documentation, in memory (but i haven't tried memory passivation store yet). Passivation store is the first place where you can find what data are exactly dumped.

Second option, more comfortable for developers is to dump BC4J debug data to the console. In 11g you'll use


parameter added to Java options. To achieve the same in 12c is to change proper log handler in logging.xml file (check solution provided here:

OK, but how to force AM to passivate its data more often or in easily reproduceable scenarios? Set recommended settings for developers - disable AM pooling and enable failover option:

-Djbo.ampool.doampooling=false -Djbo.dofailover=true

or in AM configuration wizard:

Now after each request each entity marked as modified will be passivated in order to hold the state. Please create entity object implementation class (I've checked only Accessors) and override two methods there: readAttrsFromXML and appendXMLElementNodes.

Drag and drop your collection on the test page as a form with navigation buttons and run the page. Change value of one of the attributes and check JDev console for the data.

In this demo I've used HR schema and REGIONS table.