Package org.springframework.data.jpa.repository.support

Examples of org.springframework.data.jpa.repository.support.JpaRepositoryFactory


  @BeforeClass
  public static void beforeClass() {
    DataSource dataSource = dataSource();
    entityManager = entityManager(dataSource);
    initFlyway(dataSource);
    factory = new JpaRepositoryFactory(entityManager);
  }
View Full Code Here


    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if (repository.get() == null) {
            synchronized (this) {
                if (repository.get() == null) {
                    repository.set(new JpaRepositoryFactory(em).getRepository(implementingInterfaceClass));
                }
            }
        }
        return method.invoke(repository.get(), args);
    }
View Full Code Here

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if (repository.get() == null) {
            synchronized (this) {
                if (repository.get() == null) {
                    repository.set(new JpaRepositoryFactory(em).getRepository(implementingInterfaceClass));
                }
            }
        }
        return method.invoke(repository.get(), args);
    }
View Full Code Here

    when(information.getJavaType()).thenReturn(Role.class);

    when(em.getEntityManagerFactory()).thenReturn(emf);
    when(emf.createEntityManager()).thenReturn(em);

    JpaRepositoryFactory factory = new JpaRepositoryFactory(em) {
      @Override
      @SuppressWarnings("unchecked")
      public <T, ID extends Serializable> JpaEntityInformation<T, ID> getEntityInformation(Class<T> domainClass) {
        return (JpaEntityInformation<T, ID>) information;
      }
    };

    repository = factory.getRepository(RoleRepository.class);
  }
View Full Code Here

    // Get an instance from the associated entity manager bean.
    EntityManager entityManager = getDependencyInstance(entityManagerBean, EntityManager.class);

    // Create the JPA repository instance and return it.
    JpaRepositoryFactory factory = new JpaRepositoryFactory(entityManager);
    return factory.getRepository(repositoryType, customImplementation);
  }
View Full Code Here

   * Gets the specified JpaRepository interface.
   * @param repositoryClass Repository interface class
   * @return JPA repository interface
   */
  public <T> T getJpaRepository(Class<T> repositoryClass) {
    JpaRepositoryFactory repositoryFactory = new JpaRepositoryFactory(this.em);
    return repositoryFactory.getRepository(repositoryClass);
  }
View Full Code Here

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if (repository.get() == null) {
            synchronized (this) {
                if (repository.get() == null) {
                    repository.set(new JpaRepositoryFactory(em).getRepository(implementingInterfaceClass));
                }
            }
        }
        return method.invoke(repository.get(), args);
    }
View Full Code Here

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if (repository.get() == null) {
            synchronized (this) {
                if (repository.get() == null) {
                    repository.set(new JpaRepositoryFactory(em).getRepository(implementingInterfaceClass));
                }
            }
        }
        return method.invoke(repository.get(), args);
    }
View Full Code Here

   * Gets the specified JpaRepository interface.
   * @param repositoryClass Repository interface class
   * @return JPA repository interface
   */
  public <T> T getJpaRepository(Class<T> repositoryClass) {
    JpaRepositoryFactory repositoryFactory = new JpaRepositoryFactory(this.em);
    return repositoryFactory.getRepository(repositoryClass);
  }
View Full Code Here

   * @param em Backing EntityManager
   * @param repositoryClass Repository interface class
   * @return JPA repository interface
   */
  public static <T> T getJpaRepository(EntityManager em, Class<T> repositoryClass) {
    JpaRepositoryFactory repositoryFactory = new JpaRepositoryFactory(em);
    return repositoryFactory.getRepository(repositoryClass);
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.jpa.repository.support.JpaRepositoryFactory

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.