Package com.vtence.tape.support

Examples of com.vtence.tape.support.UnitOfWork


    @Test public void
    insertingANewRecord() throws Exception {
        final Product original = aProduct().withNumber("12345678").named("English Bulldog").describedAs("A muscular heavy dog").build();

        transactor.perform(new UnitOfWork() {
            public void execute() throws Exception {
                int inserted = Insert.into(products, original).execute(connection);
                assertThat("records inserted", inserted, is(1));
            }
        });
View Full Code Here


    @Test public void
    insertingAEntityWillSetItsIdentifier() throws Exception {
        final Product entity = aProduct().build();
        assertThat("orginal id", idOf(entity), nullValue());

        transactor.perform(new UnitOfWork() {
            public void execute() throws Exception {
                Insert.into(products, entity).execute(connection);
            }
        });
View Full Code Here

        persist(aProduct().named("Dalmatian"));
        final Product original = persist(aProduct().withNumber("12345678").named("English Bulldog").describedAs("A muscular heavy dog"));

        original.setName("Labrador Retriever");
        original.setDescription("A fun type of dog");
        transactor.perform(new UnitOfWork() {
            public void execute() throws Exception {
                int updated = Update.set(products, original).where("number = ?", "12345678").execute(connection);
                assertThat("records updated", updated, is(1));
            }
        });
View Full Code Here

    private Product persist(Builder<Product> productBuilder) throws Exception {
        return persist(productBuilder.build());
    }

    private Product persist(final Product product) throws Exception {
        transactor.perform(new UnitOfWork() {
            public void execute() throws Exception {
                Insert.into(products, product).execute(connection);
            }
        });
View Full Code Here

    deletingAllRecords() throws Exception {
        persist(aProduct().named("English Bulldog"),
                aProduct().named("Labrador Retriever"),
                aProduct().named("Dalmatian"));

        transactor.perform(new UnitOfWork() {
            public void execute() throws Exception {
                int deleted = Delete.from(products).execute(connection);
                assertThat("records deleted", deleted, is(3));
            }
        });
View Full Code Here

    deletingAnExistingRecord() throws Exception {
        persist(aProduct().withNumber("12345678").named("English Bulldog"),
                aProduct().named("Labrador Retriever"),
                aProduct().named("Dalmatian"));

        transactor.perform(new UnitOfWork() {
            public void execute() throws Exception {
                int deleted = Delete.from(products).where("number = ?", "12345678").execute(connection);
                assertThat("records deleted", deleted, is(1));
            }
        });
View Full Code Here

    private Product persist(final Builder<Product> builder) throws Exception {
        return persist(builder.build());
    }

    private Product persist(final Product product) throws Exception {
        transactor.perform(new UnitOfWork() {
            public void execute() throws Exception {
                Insert.into(products, product).execute(connection);
            }
        });
View Full Code Here

    private <T> T persist(final Builder<T> builder) throws Exception {
        return persist(builder.build());
    }

    private <T> T persist(final T entity) throws Exception {
        transactor.perform(new UnitOfWork() {
            public void execute() throws Exception {
                Insert.into(tableFor(entity), entity).execute(connection);
            }
        });
        return entity;
View Full Code Here

TOP

Related Classes of com.vtence.tape.support.UnitOfWork

Copyright © 2018 www.massapicom. 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.