Package org.datanucleus

Examples of org.datanucleus.Transaction


     * @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 NucleusUserException(LOCALISER.msg("027002"),sm.getInternalObjectId());
    }

        if (tx.isActive() && ! tx.getOptimistic())
        {
            // Save the fields for rollback.
            sm.saveFields();
            sm.refreshLoadedFields();
            return changeState(sm, P_CLEAN);
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 NucleusUserException(LOCALISER.msg("027001"), sm.getInternalObjectId());
        }
        if (tx.isActive())
        {
            // Save the fields for rollback.
            sm.saveFields();

            return changeState(sm, P_DIRTY);
View Full Code Here

   * @param fgOnly only the current fetch group fields
     * @return new LifeCycle state.
     **/
    public LifeCycleState transitionRetrieve(StateManager sm, boolean fgOnly)
    {
        Transaction tx = sm.getObjectManager().getTransaction();
        if (tx.isActive() && !tx.getOptimistic())
        {
            // Save the fields for rollback.
            sm.saveFields();
        if (fgOnly)
            {
                sm.loadUnloadedFieldsInFetchPlan();
            }
        else
            {
          sm.loadUnloadedFields();
            }            
            return changeState(sm, P_CLEAN);
        }
        else if (tx.isActive() && tx.getOptimistic())
        {
            // Save the fields for rollback.
            sm.saveFields();
        if (fgOnly)
            {
View Full Code Here

     * @param fetchPlan the fetch plan to load fields
     * @return new LifeCycle state.
     **/
    public LifeCycleState transitionRetrieve(StateManager sm, FetchPlan fetchPlan)
    {
        Transaction tx = sm.getObjectManager().getTransaction();
        if (tx.isActive() && !tx.getOptimistic())
        {
            // Save the fields for rollback.
            sm.saveFields();
            sm.loadUnloadedFieldsOfClassInFetchPlan(fetchPlan);
            return changeState(sm, P_CLEAN);
        }
        else if (tx.isActive() && tx.getOptimistic())
        {
            // Save the fields for rollback.
            sm.saveFields();
            sm.loadUnloadedFieldsOfClassInFetchPlan(fetchPlan);
            return this;
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

        // 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 sm StateManager.
     * @return new LifeCycle state.
     **/
    public LifeCycleState transitionWriteField(StateManager sm)
    {
        Transaction tx = sm.getObjectManager().getTransaction();
        if (tx.getRestoreValues())
        {
            sm.saveFields();
        }

        return changeState(sm, P_DIRTY);
View Full Code Here

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

        Transaction tx = sm.getObjectManager().getTransaction();
    if (tx.isActive())
    {
      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("027002"), sm.getInternalObjectId());
    }
        if (tx.isActive() && !tx.getOptimistic())
        {
            // Save the fields for rollback.
            sm.saveFields();
            sm.refreshLoadedFields();
            return changeState(sm, P_CLEAN);
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());
        }
        if (tx.isActive())
        {
            // Save the fields for rollback.
            sm.saveFields();
            return changeState(sm, P_DIRTY);
        }
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.