org.springframework.data.jpa.provider.PersistenceProvider Java Examples

The following examples show how to use org.springframework.data.jpa.provider.PersistenceProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GenericJpaRepositoryFactory.java    From spring-data-jpa-extra with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new {@link JpaRepositoryFactory}.
 *
 * @param entityManager must not be {@literal null}
 */
GenericJpaRepositoryFactory(EntityManager entityManager) {
    super(entityManager);
    this.entityManager = entityManager;
    this.extractor = PersistenceProvider.fromEntityManager(entityManager);

    final AssemblerInterceptor assemblerInterceptor = new AssemblerInterceptor();
    addRepositoryProxyPostProcessor((factory, repositoryInformation) -> factory.addAdvice(assemblerInterceptor));
}
 
Example #2
Source File: GenericJpaRepositoryFactory.java    From genericdao with Artistic License 2.0 5 votes vote down vote up
public GenericJpaRepositoryFactory(EntityManager entityManager , SqlSessionTemplate sqlSessionTemplate) {
	super(entityManager) ;
	//设置当前类的实体管理器
	this.entityManager = entityManager ;
	//设置sqlSessionTemplate,线程安全
	this.sqlSessionTemplate = sqlSessionTemplate ;

	this.extractor = PersistenceProvider.fromEntityManager(entityManager);
}
 
Example #3
Source File: EntityGraphJpaRepositoryFactory.java    From spring-data-jpa-entity-graph with MIT License 5 votes vote down vote up
/**
 * Creates a new {@link JpaRepositoryFactory}.
 *
 * @param entityManager must not be {@literal null}
 */
public EntityGraphJpaRepositoryFactory(EntityManager entityManager) {
  super(entityManager);
  addRepositoryProxyPostProcessor(new RepositoryMethodEntityGraphExtractor(entityManager));
  setQueryMethodFactory(
      new EntityGraphAwareJpaQueryMethodFactory(
          PersistenceProvider.fromEntityManager(entityManager)));
}