Package org.jpox

Examples of org.jpox.Transaction


   * @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(); //TODO this is wrong... saving all the time, retrieve is asked... side effects besides performance?
        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(); //TODO this is wrong... saving all the time, retrieve is asked... side effects besides performance?
            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

     * @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());
        }
        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

     * @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 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 JDOUserException(LOCALISER.msg("027002"),sm.getInternalObjectId());
    }
        return this;
    }
View Full Code Here

        }

        // Perform the query
        try
        {
            Transaction tx = om.getTransaction();
            ManagedConnection mconn = storeMgr.getConnection(om);
            SQLController sqlControl = storeMgr.getSQLController();
            boolean useUpdateLock = ((Boolean)tx.getOptions().get("transaction.serializeReadObjects")).booleanValue();
            String statement = storeMgr.getStatementTextForQuery(qs_base, useUpdateLock);
            try
            {
                PreparedStatement ps = storeMgr.getStatementForQuery(qs_base, om, mconn, useUpdateLock, null, null);
                try
View Full Code Here

TOP

Related Classes of org.jpox.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.