Package org.springframework.data.jpa.domain.sample

Examples of org.springframework.data.jpa.domain.sample.User


  @Before
  public void setUp() {

    // This one matches both criterias
    dave = new User("Dave", "Matthews", "dave@dmband.com");
    userRepository.save(dave);

    // This one matches only the second one
    carter = new User("Carter", "Beauford", "carter@dmband.com");
    userRepository.save(carter);

    oliver = new User("Oliver August", "Matthews", "oliver@dmband.com");
    userRepository.save(oliver);
  }
View Full Code Here


   * Tests creation of a simple query.
   */
  @Test
  public void testSimpleCustomCreatedFinder() {

    User user = userRepository.findByEmailAddressAndLastname("dave@dmband.com", "Matthews");
    assertEquals(dave, user);
  }
View Full Code Here

   * object.
   */
  @Test
  public void returnsNullIfNothingFound() {

    User user = userRepository.findByEmailAddress("foobar");
    assertEquals(null, user);
  }
View Full Code Here

  @Test
  @Ignore
  public void bindArray() {

    User user = new User("Dave", "Matthews", "foo@bar.de");
    em.persist(user);
    em.flush();

    CriteriaBuilder builder = em.getCriteriaBuilder();
View Full Code Here

  @Test
  @SuppressWarnings("rawtypes")
  public void bindCollection() {

    User user = new User("Dave", "Matthews", "foo@bar.de");
    em.persist(user);
    em.flush();

    CriteriaBuilder builder = em.getCriteriaBuilder();
View Full Code Here

  @Test
  @Transactional
  public void useUserRepository() throws Exception {

    userRepository.saveAndFlush(new User("firstname", "lastname", "foo@bar.de"));
  }
View Full Code Here

    JpaEntityInformation<User, Integer> information = new JpaMetamodelEntityInformation<User, Integer>(User.class,
        em.getMetamodel());

    repository = new QueryDslJpaRepository<User, Integer>(information, em);
    dave = repository.save(new User("Dave", "Matthews", "dave@matthews.com"));
    carter = repository.save(new User("Carter", "Beauford", "carter@beauford.com"));
    oliver = repository.save(new User("Oliver", "matthews", "oliver@matthews.com"));
    adminRole = em.merge(new Role("admin"));
  }
View Full Code Here

  User dave, carter;

  @Before
  public void setup() {

    dave = new User("Dave", "Matthews", "dave@matthews.com");
    em.persist(dave);

    carter = new User("Carter", "Beauford", "carter@beauford.com");
    em.persist(carter);

    UserRepositoryImpl repository = new UserRepositoryImpl();
    repository.setEntityManager(em);
    repository.validate();
View Full Code Here

  }

  @Test
  public void simpleManipulatingOperation() throws Exception {

    repository.saveAndFlush(new User("foo", "bar", "foo@bar.de"));
    assertThat(transactionManager.getTransactionRequests(), is(1));
  }
View Full Code Here

  @Test
  public void considersEntityWithNonPrimitiveNonNullIdTypeNotNew() {

    EntityInformation<User, Long> information = getEntityInformation(User.class);

    User user = new User();
    assertThat(information.isNew(user), is(true));

    user.setId(0);
    assertThat(information.isNew(user), is(false));
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.jpa.domain.sample.User

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.