Class GenericActivationHolder

java.lang.Object
org.apache.derby.impl.sql.GenericActivationHolder
All Implemented Interfaces:
Dependable, Activation, Dependent

public final class GenericActivationHolder extends Object implements Activation
This class holds an Activation, and passes through most of the calls to the activation. The purpose of this class is to allow a PreparedStatement to be recompiled without the caller having to detect this and get a new activation. In addition to the Activation, this class holds a reference to the PreparedStatement that created it, along with a reference to the GeneratedClass that was associated with the PreparedStatement at the time this holder was created. These references are used to validate the Activation, to ensure that an activation is used only with the PreparedStatement that created it, and to detect when recompilation has happened. We detect recompilation by checking whether the GeneratedClass has changed. If it has, we try to let the caller continue to use this ActivationHolder. We create a new instance of the new GeneratedClass (that is, we create a new Activation), and we compare the number and type of parameters. If these are compatible, we copy the parameters from the old to the new Activation. If they are not compatible, we throw an exception telling the user that the Activation is out of date, and they need to get a new one.