Package org.qi4j.api.unitofwork

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


            product.price().set( 100 );
            unitOfWork.complete();
        }
        finally
        {
            unitOfWork.discard();
        }
    }

    public interface ProductCatalog
    {
View Full Code Here


            Abc abc = uow.get( Abc.class, "123" );
            assertEquals( "Niclas", abc.name().get() );
        }
        finally
        {
            uow.discard();
        }
    }

    @Test
    public void givenEntityCreatedWhenRemovingEntityThenFindNewEntityShouldNotExist()
View Full Code Here

        {
            // Expected.
        }
        finally
        {
            uow.discard();
        }
    }

    @Test
    public void givenDetachedEntityWhenRemovingEntityThenFindNewEntityShouldNotExist()
View Full Code Here

        {
            // Expected.
        }
        finally
        {
            uow.discard();
        }
    }

    @Test
    public void givenEntityCreatedWhenRemovingEntityBeforeCompletingUowThenFindNewEntityShouldNotExist()
View Full Code Here

        {
            // Expected.
        }
        finally
        {
            uow.discard();
        }
    }

    public interface Abc
        extends EntityComposite
View Full Code Here

            uow.complete();
            fail( "Should not be allowed to set invalid property value" );
        }
        catch( Exception e )
        {
            uow.discard();
        }
    }

    @Test
    public void givenEntityWithComplexConstrainedPropertyWhenInvalidPropertyValueSetThenThrowException()
View Full Code Here

            uow.complete();
            fail( "Should not be allowed to set invalid property value" );
        }
        catch( Exception e )
        {
            uow.discard();
        }
    }

    interface TestCase
        extends EntityComposite
View Full Code Here

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

    @Test
    public void givenOptionalAssociationWhenOptionalSetThenNoException()
View Full Code Here

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

    @Test( expected = ConstraintViolationException.class )
    public void givenMandatoryAssociationWhenMandatoryMissingThenException()
View Full Code Here

            TestComposite3 testComposite3 = builder.newInstance();

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

    @Mixins( TestComposite.TestMixin.class )
    public interface TestComposite
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.