Package org.datanucleus

Examples of org.datanucleus.Transaction


     * @param sm StateManager.
     * @return new LifeCycle state.
     */
    public LifeCycleState transitionWriteField(StateManager sm)
    {
        Transaction tx = sm.getObjectManager().getTransaction();
        if (!tx.isActive() && !tx.getNontransactionalWrite())
        {
            throw new NucleusUserException(LOCALISER.msg("027001"), sm.getInternalObjectId());
        }
        return changeState(sm, tx.isActive() ? P_DIRTY : P_NONTRANS);
    }
View Full Code Here


        }
        else
        {
            sm.loadUnloadedFields();
        }
        Transaction tx = sm.getObjectManager().getTransaction();
        if (!tx.getOptimistic() && tx.isActive())
        {
            return changeState(sm, P_CLEAN);
        }
        else if (tx.getOptimistic())
        {
            return changeState(sm, P_NONTRANS);
        }
        return super.transitionRetrieve(sm, fgOnly);
    }
View Full Code Here

     * @return new LifeCycle state.
     **/
    public LifeCycleState transitionRetrieve(StateManager sm, FetchPlan fetchPlan)
    {
        sm.loadUnloadedFieldsOfClassInFetchPlan(fetchPlan);
        Transaction tx = sm.getObjectManager().getTransaction();
        if (!tx.getOptimistic() && tx.isActive())
        {
            return changeState(sm, P_CLEAN);
        }
        else if (tx.getOptimistic())
        {
            return changeState(sm, P_NONTRANS);
        }
        return super.transitionRetrieve(sm, fetchPlan);
    }
View Full Code Here

     * @param sm State Manager
     * @return The new LifeCycle state
     */
    public LifeCycleState transitionSerialize(StateManager sm)
    {
        Transaction tx = sm.getObjectManager().getTransaction();
        if (tx.isActive() && !tx.getOptimistic())
        {
            return changeState(sm, P_CLEAN);
        }
        return this;
    }
View Full Code Here

     * @param sm The StateManager
     * @see LifeCycleState#transitionWriteField(StateManager sm)
     */
    public LifeCycleState transitionWriteField(StateManager sm)
    {
        Transaction tx = sm.getObjectManager().getTransaction();
        if (tx.isActive())
        {
            sm.saveFields();
            return changeTransientState(sm,T_DIRTY);
        }
        else
View Full Code Here

        // Refresh the FetchPlan fields and unload all others
        sm.refreshFieldsInFetchPlan();
        sm.unloadNonFetchPlanFields();

        Transaction tx = sm.getObjectManager().getTransaction();
        if (tx.isActive() && !tx.getOptimistic())
        {
            return changeState(sm,P_CLEAN);
        }
        return changeState(sm,P_NONTRANS);     
    }
View Full Code Here

     * @param isLoaded if the field was previously loaded
     * @return new LifeCycle state.
     */
    public LifeCycleState transitionReadField(StateManager sm, boolean isLoaded)
    {
        Transaction tx = sm.getObjectManager().getTransaction();
        if (!tx.isActive() && !tx.getNontransactionalRead())
        {
            throw new TransactionNotReadableException(LOCALISER.msg("027000"), sm.getInternalObjectId());
        }
        else if (!tx.isActive() && sm.getClassMetaData().getIdentityType() == IdentityType.NONDURABLE)
        {
            // JDO2 spec 5.4.4
            throw new NucleusUserException("Not able to read fields of nondurable object when in HOLLOW state");
        }
        if (!tx.getOptimistic() && tx.isActive())
        {
            return changeState(sm, P_CLEAN);
        }
        else
        {
View Full Code Here

     * @param sm StateManager.
     * @return new LifeCycle state.
     */
    public LifeCycleState transitionWriteField(StateManager sm)
    {
        Transaction tx = sm.getObjectManager().getTransaction();
        if (!tx.isActive() && !tx.getNontransactionalWrite())
        {
            throw new TransactionNotWritableException(LOCALISER.msg("027001"), sm.getInternalObjectId());
        }
        return changeState(sm, tx.isActive() ? P_DIRTY : P_NONTRANS);
    }
View Full Code Here

        }
        else
        {
            sm.loadUnloadedFields();
        }
        Transaction tx = sm.getObjectManager().getTransaction();
        if (!tx.getOptimistic() && tx.isActive())
        {
            return changeState(sm, P_CLEAN);
        }
        else if (tx.getOptimistic())
        {
            return changeState(sm, P_NONTRANS);
        }
        return super.transitionRetrieve(sm, fgOnly);
    }
View Full Code Here

     * @return new LifeCycle state.
     **/
    public LifeCycleState transitionRetrieve(StateManager sm, FetchPlan fetchPlan)
    {
        sm.loadUnloadedFieldsOfClassInFetchPlan(fetchPlan);
        Transaction tx = sm.getObjectManager().getTransaction();
        if (!tx.getOptimistic() && tx.isActive())
        {
            return changeState(sm, P_CLEAN);
        }
        else if (tx.getOptimistic())
        {
            return changeState(sm, P_NONTRANS);
        }
        return super.transitionRetrieve(sm, fetchPlan);
    }
View Full Code Here

TOP

Related Classes of org.datanucleus.Transaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.