Package org.hibernate

Examples of org.hibernate.Session.lock()


    myEntity = (MyEntity) s1.get( MyEntity.class, myEntity.getId() );
    s1.lock( myEntity, LockMode.FORCE );
    assertTrue( "LockMode.FORCE on a un-versioned entity should degrade nicely to UPGRADE", true );

    s1.lock( item, LockMode.FORCE );
    assertEquals( "subsequent LockMode.FORCE did not no-op", initialVersion + 1, item.getVersion() );

    Session s2 = getSessions().openSession();
    Transaction t2 = s2.beginTransaction();
    Item item2 = (Item) s2.get( Item.class, itemId );
View Full Code Here


        if (session!=null) {
          LockMode lockMode = LockMode.FORCE;
          if (parentLockMode!=null) {
            lockMode = LockMode.parse(parentLockMode);
          }
          session.lock(parentToken, lockMode);
        }

        boolean reactivateParent = true;

        // if this is a discriminator
View Full Code Here

    TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "text"));

    s = factory.openSession();
    s.setCacheMode( CacheMode.IGNORE );
    t = s.beginTransaction();
    s.lock(doc, LockMode.NONE);
    TestCase.assertFalse(Hibernate.isPropertyInitialized(doc, "text"));
    TestCase.assertEquals( doc.getText(), "blah blah" );
    TestCase.assertTrue(Hibernate.isPropertyInitialized(doc, "text"));
    t.commit();
    s.close();
View Full Code Here

    if ( object != null )
    {
       // -> if versioning is on create new object items
       if ( SBucket.VERSIONING_ENABLED == versioningStatus )
       {
            session.lock(object, LockMode.UPGRADE);
            versionSeq = object.getNextSequence();
            object.setNextSequence(versionSeq + 1);
             session.save(object);
           
            item = new SObjectItem();
View Full Code Here

          LockMode lockMode = LockMode.FORCE;
          if (parentLockMode!=null) {
            lockMode = LockMode.parse(parentLockMode);
          }
          log.debug("forcing version increment on parent token "+parentToken);
          session.lock(parentToken, lockMode);
        }

        boolean reactivateParent = true;

        // if this is a discriminator
View Full Code Here

     
    } else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
     
      // force version increment in the parent execution
      Session session = Environment.getFromCurrent(Session.class);
      session.lock(execution.getParent(), lockMode);

      execution.setState(Execution.STATE_INACTIVE_JOIN);
      execution.waitForSignal();

      ExecutionImpl concurrentRoot = execution.getParent();
View Full Code Here

    // perform the isolated update
    s1 = getSessions().openSession();
    t1 = s1.beginTransaction();
    item = (Item) s1.get( Item.class, itemId );
    s1.lock( item, LockMode.UPGRADE );
    item.setName( "updated" );
    s1.flush();

    Session s2 = getSessions().openSession();
    Transaction t2 = s2.beginTransaction();
View Full Code Here

    long initialVersion = item.getVersion();

    s1 = getSessions().openSession();
    t1 = s1.beginTransaction();
    item = (Item) s1.get( Item.class, itemId );
    s1.lock( item, LockMode.FORCE );
    assertEquals( "no forced version increment", initialVersion + 1, item.getVersion() );

    myEntity = (MyEntity) s1.get( MyEntity.class, myEntity.getId() );
    s1.lock( myEntity, LockMode.FORCE );
    assertTrue( "LockMode.FORCE on a unversioned entity should degrade nicely to UPGRADE", true );
View Full Code Here

    item = (Item) s1.get( Item.class, itemId );
    s1.lock( item, LockMode.FORCE );
    assertEquals( "no forced version increment", initialVersion + 1, item.getVersion() );

    myEntity = (MyEntity) s1.get( MyEntity.class, myEntity.getId() );
    s1.lock( myEntity, LockMode.FORCE );
    assertTrue( "LockMode.FORCE on a unversioned entity should degrade nicely to UPGRADE", true );

    s1.lock( item, LockMode.FORCE );
    assertEquals( "subsequent LockMode.FORCE did not no-op", initialVersion + 1, item.getVersion() );
View Full Code Here

    myEntity = (MyEntity) s1.get( MyEntity.class, myEntity.getId() );
    s1.lock( myEntity, LockMode.FORCE );
    assertTrue( "LockMode.FORCE on a unversioned entity should degrade nicely to UPGRADE", true );

    s1.lock( item, LockMode.FORCE );
    assertEquals( "subsequent LockMode.FORCE did not no-op", initialVersion + 1, item.getVersion() );

    Session s2 = getSessions().openSession();
    Transaction t2 = s2.beginTransaction();
    Item item2 = (Item) s2.get( Item.class, itemId );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.