Package org.qi4j.api.unitofwork

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


            while( module.isUnitOfWorkActive())
            {
                UnitOfWork uow = module.currentUnitOfWork();
                if( uow.isOpen() )
                {
                    uow.discard();
                }
                else
                {
                    throw new InternalError( "I have seen a case where a UoW is on the stack, but not opened." );
                }
View Full Code Here


                .serializableProperty().get(), equalTo( mapValue ) );

            assertThat( "association has correct value", instance.association().get(), equalTo( instance ) );
            assertThat( "manyAssociation has correct value", instance.manyAssociation()
                .iterator().next(), equalTo( instance ) );
            unitOfWork.discard();
        }
        finally
        {
            unitOfWork.discard();
        }
View Full Code Here

                .iterator().next(), equalTo( instance ) );
            unitOfWork.discard();
        }
        finally
        {
            unitOfWork.discard();
        }
    }

    @Test
    public void whenRemovedEntityThenCannotFindEntity()
View Full Code Here

        {
            // Ok!
        }
        finally
        {
            unitOfWork.discard();
        }
    }

    @Test
    public void givenEntityIsNotModifiedWhenUnitOfWorkCompletesThenDontStoreState()
View Full Code Here

            unitOfWork1 = module.newUnitOfWork();
            testEntity1 = unitOfWork1.get( testEntity );
            version = spi.getEntityState( testEntity1 ).version();
            if( version.equals( "" ) )
            {
                unitOfWork1.discard();
                return; // Store doesn't track versions - no point in testing it
            }
            testEntity1.name().set( "A" );
            testEntity1.unsetName().set( "A" );
        }
View Full Code Here

            while( module.isUnitOfWorkActive())
            {
                UnitOfWork uow = module.currentUnitOfWork();
                if( uow.isOpen() )
                {
                    uow.discard();
                }
                else
                {
                    throw new InternalError( "I have seen a case where a UoW is on the stack, but not opened." );
                }
View Full Code Here

                Assert.assertTrue(builder.where(where ).newQuery( entities ).find().equals( testEntity ));
            }
        }
        finally
        {
            uow.discard();
        }
    }

    public interface TestEntity
        extends EntityComposite
View Full Code Here

                unitOfWork.complete();
            }
        }
        finally
        {
            unitOfWork.discard();
        }
    }
}
View Full Code Here

            unitOfWork.complete();
        }
        finally
        {
            unitOfWork.discard();
        }
    }

    @Mixins(PersonEntity.Mixin.class)
    public interface PersonEntity
View Full Code Here

            id = ( (Identity) catalog.newProduct() ).identity().get();
            unitOfWork.complete();
        }
        finally
        {
            unitOfWork.discard();
        }

        unitOfWork = module.newUnitOfWork();
        try
        {
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.