Package org.qi4j.api.unitofwork

Examples of org.qi4j.api.unitofwork.UnitOfWork.complete()


            UnitOfWork unitOfWork = module.newUnitOfWork();
            testEntity = unitOfWork.get( testEntity );
            String newVersion = spi.getEntityState( testEntity ).version();
            assertThat( "version has changed", newVersion, not( equalTo( version ) ) );

            unitOfWork.complete();
        }
    }

    @Test
    public void givenManyAssociationIsModifiedWhenUnitOfWorkCompletesThenStoreState()
View Full Code Here


        {
            UnitOfWork unitOfWork = module.newUnitOfWork();
            EntityBuilder<TestEntity> builder = unitOfWork.newEntityBuilder( TestEntity.class );

            testEntity = builder.newInstance();
            unitOfWork.complete();
        }

        {
            UnitOfWork unitOfWork = module.newUnitOfWork();
            testEntity = unitOfWork.get( testEntity );
View Full Code Here

            UnitOfWork unitOfWork = module.newUnitOfWork();
            testEntity = unitOfWork.get( testEntity );
            testEntity.manyAssociation().add( 0, testEntity );
            version = spi.getEntityState( testEntity ).version();

            unitOfWork.complete();
        }

        {
            UnitOfWork unitOfWork = module.newUnitOfWork();
            testEntity = unitOfWork.get( testEntity );
View Full Code Here

            UnitOfWork unitOfWork = module.newUnitOfWork();
            testEntity = unitOfWork.get( testEntity );
            String newVersion = spi.getEntityState( testEntity ).version();
            assertThat( "version has changed", newVersion, not( equalTo( version ) ) );

            unitOfWork.complete();
        }
    }

    @Test
    public void givenConcurrentUnitOfWorksWhenUoWCompletesThenCheckConcurrentModification()
View Full Code Here

        {
            UnitOfWork unitOfWork = module.newUnitOfWork();
            EntityBuilder<TestEntity> builder = unitOfWork.newEntityBuilder( TestEntity.class );

            testEntity = builder.newInstance();
            unitOfWork.complete();
        }

        UnitOfWork unitOfWork1;
        TestEntity testEntity1;
        String version;
View Full Code Here

            // Start working with same Entity in another UoW, and complete it
            UnitOfWork unitOfWork = module.newUnitOfWork();
            TestEntity testEntity2 = unitOfWork.get( testEntity );
            assertThat( "version is correct", spi.getEntityState( testEntity1 ).version(), equalTo( version ) );
            testEntity2.name().set( "B" );
            unitOfWork.complete();
        }

        {
            // Try to complete first UnitOfWork
            try
View Full Code Here

        {
            EntityBuilder<TestEntity> entityBuilder = uow.newEntityBuilder( TestEntity.class, "123" );
            entityBuilder.instance().value().set( assembler.module().newValue( TestValue.class ) );
            TestEntity testEntity = entityBuilder.newInstance();

            uow.complete();
            uow = assembler.module().newUnitOfWork();

            Iterable<TestEntity> entities = Iterables.iterable( testEntity = uow.get( testEntity ) );

            QueryBuilder<TestEntity> builder = assembler.module().newQueryBuilder( TestEntity.class );
View Full Code Here

                EntityBuilder<CatEntity> catBuilder = unitOfWork.newEntityBuilder( CatEntity.class );
                Cat felix = catBuilder.instance();
                felix.name().set( "Felix" );
                felix = catBuilder.newInstance();
                // NameableAssert.trace( felix );
                unitOfWork.complete();
            }
        }
        finally
        {
            unitOfWork.discard();
View Full Code Here

            charles.befriend( daniel );
            charles.befriend( lisa );
            charles.marry( lisa );

            unitOfWork.complete();

            unitOfWork = module.newUnitOfWork(  );

            charles = unitOfWork.get( charles );
            daniel = unitOfWork.get( daniel );
View Full Code Here

            charles = unitOfWork.get( charles );
            daniel = unitOfWork.get( daniel );
            Assert.assertTrue( charles.isFriend( daniel ) );

            unitOfWork.complete();
        }
        finally
        {
            unitOfWork.discard();
        }
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.