Package org.qi4j.api.unitofwork

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


            {
                int bulk = 0;
                UnitOfWork uow = module.newUnitOfWork( newUsecase( "readEntityWithComplexType PREPARE " + bulk ) );
                for( int i = 0; i < ITERATIONS; i++ )
                {
                    ComplexProduct product = uow.newEntity( ComplexProduct.class, "product" + i );
                    product.name().set( "Product " + i );

                    if( i % 1000 == 0 )
                    {
                        uow.complete();
View Full Code Here


                  carrierMovement( HAMBURG, STOCKHOLM, day( 17 ), day( 19 ) ),
                  carrierMovement( STOCKHOLM, HELSINKI, day( 20 ), day( 21 ) )
              ) );

              // Cargo and HandlingEvent factories
                CargosEntity CARGOS = uow.newEntity( CargosEntity.class, CargosEntity.CARGOS_ID );
                uow.newEntity( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
 
              logger.debug( "BASIC DATA CREATED" );
              uow.complete();
            }
View Full Code Here

                  carrierMovement( STOCKHOLM, HELSINKI, day( 20 ), day( 21 ) )
              ) );

              // Cargo and HandlingEvent factories
                CargosEntity CARGOS = uow.newEntity( CargosEntity.class, CargosEntity.CARGOS_ID );
                uow.newEntity( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
 
              logger.debug( "BASIC DATA CREATED" );
              uow.complete();
            }
            catch(Exception e)
View Full Code Here

                    module.layer().application().setVersion( "1.0" );
                }
            };

            UnitOfWork uow = v1.module().newUnitOfWork();
            TestEntity1_0 entity = uow.newEntity( TestEntity1_0.class );
            entity.foo().set( "Some value" );
            entity.fooManyAssoc().add( entity );
            entity.fooAssoc().set( entity );
            id = entity.identity().get();
            uow.complete();
View Full Code Here

    public void showUsage()
    {
        {
// START SNIPPET: indirect
            UnitOfWork unitOfWork = module.currentUnitOfWork();
            Person person = unitOfWork.newEntity( Person.class );
// END SNIPPET: indirect
        }
        {
// START SNIPPET: direct
            UnitOfWork unitOfWork = module.currentUnitOfWork();
View Full Code Here

// END SNIPPET: indirect
        }
        {
// START SNIPPET: direct
            UnitOfWork unitOfWork = module.currentUnitOfWork();
            PersonEntity person = unitOfWork.newEntity( PersonEntity.class );
// END SNIPPET: direct
        }
    }

    public interface Person
View Full Code Here

        throws UnitOfWorkCompletionException
    {
        UnitOfWork uow = module.newUnitOfWork();
        try
        {
            uow.newEntity( Person.class, "" + id );
            uow.complete();
        }
        finally
        {
            if( uow.isOpen())
View Full Code Here

        throws UnitOfWorkCompletionException
    {
        UnitOfWork uow = module.newUnitOfWork();
        try
        {
            uow.newEntity( Person.class, "" + id );
            uow.complete();
        }
        finally
        {
            if( uow.isOpen())
View Full Code Here

    @Test
    public void createAndRemoveEntityAndVerifyNoExtraDataLeftInDB()
        throws Exception
    {
        UnitOfWork uow = this.module.newUnitOfWork();
        TestEntity entity = uow.newEntity( TestEntity.class );
        uow.complete();

        uow = this.module.newUnitOfWork();
        entity = uow.get( entity );
        SQLConfiguration config = uow.get( SQLConfiguration.class, PostgreSQLIndexQueryAssembler.DEFAULT_IDENTITY );
View Full Code Here

    @Test
    public void createAndModifyEntity()
        throws Exception
    {
        UnitOfWork uow = this.module.newUnitOfWork();
        TestEntity entity = uow.newEntity( TestEntity.class );
        uow.complete();

        uow = this.module.newUnitOfWork();
        entity = uow.get( entity );
        entity.testString().set( "NewTestString" );
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.