Package org.qi4j.api.unitofwork

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


        }
        catch (EntityTypeNotFoundException e)
        {
            // Ok
            ProductCatalog catalog = unitOfWork.newEntity( ProductCatalog.class, "1" );
            unitOfWork.complete();
        }
        unitOfWork = uowf.newUnitOfWork();

        String id;
        try
View Full Code Here


        String id;
        try
        {
            ProductCatalog catalog = unitOfWork.get( ProductCatalog.class, "1" );
            id = ( (Identity) catalog.newProduct() ).identity().get();
            unitOfWork.complete();
        }
        finally
        {
            unitOfWork.discard();
        }
View Full Code Here

        try
        {
            ProductCatalog catalog = unitOfWork.get( ProductCatalog.class, "1" );
            Product product = catalog.findProduct( id );
            product.price().set( 100 );
            unitOfWork.complete();
        }
        finally
        {
            unitOfWork.discard();
        }
View Full Code Here

        try
        {
            EntityBuilder<Abc> builder = uow.newEntityBuilder( Abc.class, "123" );
            builder.instance().name().set( "Niclas" );
            builder.newInstance();
            uow.complete();
            uow = module.newUnitOfWork();
            Abc abc = uow.get( Abc.class, "123" );
            assertEquals( "Niclas", abc.name().get() );
        }
        finally
View Full Code Here

        try
        {
            EntityBuilder<Abc> builder = uow.newEntityBuilder( Abc.class, "123" );
            builder.instance().name().set( "Niclas" );
            builder.newInstance();
            uow.complete();
            uow = module.newUnitOfWork();
            Abc abc = uow.get( Abc.class, "123" );
            assertEquals( "Niclas", abc.name().get() );
            uow.remove( abc );
            uow.complete();
View Full Code Here

            uow.complete();
            uow = module.newUnitOfWork();
            Abc abc = uow.get( Abc.class, "123" );
            assertEquals( "Niclas", abc.name().get() );
            uow.remove( abc );
            uow.complete();
            uow = module.newUnitOfWork();
            uow.get( Abc.class, "123" );
            fail( "This '123' entity should not exist." );
        }
        catch( NoSuchEntityException e )
View Full Code Here

        try
        {
            EntityBuilder<Abc> builder = uow.newEntityBuilder( Abc.class, "123" );
            builder.instance().name().set( "Niclas" );
            Abc abc = builder.newInstance();
            uow.complete();
            uow = module.newUnitOfWork();
            abc = uow.get( abc )// Attach the detached entity to 'uow' session.
            uow.remove( abc );
            uow.complete();
            uow = module.newUnitOfWork();
View Full Code Here

            Abc abc = builder.newInstance();
            uow.complete();
            uow = module.newUnitOfWork();
            abc = uow.get( abc )// Attach the detached entity to 'uow' session.
            uow.remove( abc );
            uow.complete();
            uow = module.newUnitOfWork();
            uow.get( Abc.class, "123" );
            fail( "This '123' entity should not exist." );
        }
        catch( NoSuchEntityException e )
View Full Code Here

        {
            EntityBuilder<Abc> builder = uow.newEntityBuilder( Abc.class, "123" );
            builder.instance().name().set( "Niclas" );
            Abc abc = builder.newInstance();
            uow.remove( abc );
            uow.complete();
            uow = module.newUnitOfWork();
            uow.get( Abc.class, "123" );
            fail( "This '123' entity should not exist." );
        }
        catch( NoSuchEntityException e )
View Full Code Here

        String actual = chair.name().get();
        org.junit.Assert.assertThat( "Chair.name()", actual, org.hamcrest.CoreMatchers.equalTo( "Chair" ) );
        org.junit.Assert.assertThat( "Chair.price()", chair.price().get(), org.hamcrest.CoreMatchers.equalTo( 57 ) );

        unitOfWork.complete();
    }

    @Mixins({AccountMixin.class})
    public interface AccountComposite
            extends Account, EntityComposite
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.