Package org.springframework.data.neo4j.aspects.support.domain

Examples of org.springframework.data.neo4j.aspects.support.domain.Account2


    @Transactional
    public void testSaveWhenFailOnDuplicateSetToTrue() {
        // Account2
        // @Indexed(unique = true, failOnDuplicate = true)
        // private String accountNumber;
        Account2 acc1 = new Account2("111-222-333", "Mr George - Current Account 1");
        Account2 acc2 = new Account2("111-222-333", "Mr George - Current Account 2");
        Account2 savedAcc1 = account2Repository.save(acc1);
        Account2 savedAcc2 = account2Repository.save(acc2);
    }
View Full Code Here


    @Transactional
    public void testSaveWhenDefaultFailOnDuplicateSetToTrueAllowsUpdates() {
        // Account2
        // @Indexed(unique = true, failOnDuplicate = true)
        // private String accountNumber;
        Account2 acc1 = new Account2("111-222-333", "Mr George - Current Account 1");
        Account2 savedAcc1 = account2Repository.save(acc1);

        acc1.setName("Mr George - Current Account 2");
        account2Repository.save(savedAcc1);
        // No exception expected!
    }
View Full Code Here

    }

    @Test @Transactional
    public void testDefaultFailOnDuplicateSetToTrueSavesCorrectlyWhenUpdating() {
        final String UPDATED_NAME = "Mr George - Current Account 2";
        Account2 acc1 = new Account2("111-222-333", "Mr George - Current Account 1");
        acc1.persist();
        acc1.setName(UPDATED_NAME);
        acc1.persist(); // This should save fine

        Account2 loadedAcc1 = account2Repository.findBySchemaPropertyValue("accountNumber","111-222-333");
        assertNotNull(loadedAcc1);
        assertEquals("Expected name to have been updated (merged) with last value",UPDATED_NAME,loadedAcc1.getName());
    }
View Full Code Here

    }

    @Test(expected = DataIntegrityViolationException.class)
    @Transactional
    public void testDefaultFailOnDuplicateSetToTrueCausesExceptionWhenAnotherDuplicateEntityCreated() {
        Account2 acc1 = new Account2("111-222-333", "Mr George - Current Account 1");
        Account2 acc2 = new Account2("111-222-333", "Mr George - Current Account 2");
        acc1.persist();
        acc2.persist(); // This should cause an exception
    }
View Full Code Here

TOP

Related Classes of org.springframework.data.neo4j.aspects.support.domain.Account2

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.