当前位置: 首页>>代码示例>>Java>>正文


Java SimpleJpaRepository类代码示例

本文整理汇总了Java中org.springframework.data.jpa.repository.support.SimpleJpaRepository的典型用法代码示例。如果您正苦于以下问题:Java SimpleJpaRepository类的具体用法?Java SimpleJpaRepository怎么用?Java SimpleJpaRepository使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SimpleJpaRepository类属于org.springframework.data.jpa.repository.support包,在下文中一共展示了SimpleJpaRepository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTargetRepository

import org.springframework.data.jpa.repository.support.SimpleJpaRepository; //导入依赖的package包/类
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
protected SimpleJpaRepository<?, ?> getTargetRepository(
        final RepositoryMetadata metadata,
        final EntityManager entityManager) {
    final Class<?> repositoryInterface = metadata.getRepositoryInterface();
    final JpaEntityInformation<?, Serializable> entityInformation = getEntityInformation(metadata.getDomainType());

    if (isQueryDslSpecificExecutor(repositoryInterface)) {
        throw new IllegalArgumentException("QueryDSL interface niet toegestaan");
    }

    return isMaxedRepository(repositoryInterface)
            ? new CustomSimpleMaxedJpaRepository(entityInformation, entityManager)
            : isQuerycostRepository(repositoryInterface)
                    ? new CustomSimpleQuerycostJpaRepository(entityInformation, entityManager, maxCostsQueryPlan)
                    : new CustomSimpleJpaRepository(entityInformation, entityManager);
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:19,代码来源:CustomJpaRepositoryFactory.java

示例2: getTargetRepository

import org.springframework.data.jpa.repository.support.SimpleJpaRepository; //导入依赖的package包/类
protected SimpleJpaRepository<?, ?> getTargetRepository(RepositoryInformation information,
    EntityManager entityManager) {
  Class<?> domainType = information.getDomainType();
  if (!hasAclStrategyAnnotation(domainType)) {
    return super.getTargetRepository(information, entityManager);
  }

  JpaEntityInformation<?, Serializable> entityInformation = getEntityInformation(domainType);

  // invokes
  // com.github.lothar.security.acl.jpa.repository.AclJpaRepository.AclJpaRepository(JpaEntityInformation<T,
  // ?>, EntityManager, JpaSpecProvider<T>)
  SimpleJpaRepository<?, ?> repository = getTargetRepositoryViaReflection(information,
      entityInformation, entityManager, jpaSpecProvider);
  logger.debug("Created {}", repository);

  return repository;
}
 
开发者ID:lordlothar99,项目名称:strategy-spring-security-acl,代码行数:19,代码来源:AclJpaRepositoryFactoryBean.java

示例3: getTargetRepository

import org.springframework.data.jpa.repository.support.SimpleJpaRepository; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected <T, ID extends Serializable> SimpleJpaRepository<?, ?> getTargetRepository(
		RepositoryInformation information, EntityManager entityManager) {
	JpaEntityInformation<?, Serializable> entityInformation = getEntityInformation(information.getDomainType());
	return new GenericRepositoryImpl(entityInformation, entityManager);
}
 
开发者ID:onsoul,项目名称:os,代码行数:8,代码来源:DefaultRepositoryFactory.java

示例4: setUp

import org.springframework.data.jpa.repository.support.SimpleJpaRepository; //导入依赖的package包/类
/**
 * Sets up a {@link SimpleJpaRepository} instance.
 */
@Before
public void setUp() {

	EntityManagerFactory factory = Persistence.createEntityManagerFactory("jpa.sample.plain");
	em = factory.createEntityManager();

	userRepository = new SimpleJpaRepository<User, Long>(User.class, em);

	em.getTransaction().begin();
}
 
开发者ID:Just-Fun,项目名称:spring-data-examples,代码行数:14,代码来源:BasicSample.java

示例5: setup

import org.springframework.data.jpa.repository.support.SimpleJpaRepository; //导入依赖的package包/类
@Before
public void setup(){
    JpaEntityInformation<TestEntity, Integer> information = new JpaMetamodelEntityInformation<>(
            TestEntity.class, em.getMetamodel());
    repository = new SimpleJpaRepository<>(information, em);
    entities = SpecificationBuilder.selectDistinctFrom(repository).where(new Filter("string",EQUAL,"a")).findAll();
    Assert.assertTrue(entities.size() >= 1);
}
 
开发者ID:ZhongjunTian,项目名称:spring-repository-plus,代码行数:9,代码来源:TestEntityRepositoryTest.java

示例6: JpaRepository

import org.springframework.data.jpa.repository.support.SimpleJpaRepository; //导入依赖的package包/类
private JpaRepository(JpaEntityInformation<T, ID> info, EntityManager em) {
	//this.entityClass = info.getJavaType();
	this.entityInformation = info;
	this.entityManager = em;
	
	this.template = new SimpleJpaRepository<T, ID>(info, em);
	this.queryDslExecutor = new JpaQueryDslExecutor<T>(info.getJavaType(), em);
}
 
开发者ID:u2ware,项目名称:springfield,代码行数:9,代码来源:JpaRepository.java

示例7: getTargetRepository

import org.springframework.data.jpa.repository.support.SimpleJpaRepository; //导入依赖的package包/类
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
protected <T, ID extends Serializable> SimpleJpaRepository<?, ?> getTargetRepository(RepositoryMetadata metadata,
		EntityManager entityManager) {

	JpaEntityInformation<T, Serializable> entityInformation = (JpaEntityInformation<T, Serializable>) getEntityInformation(metadata
			.getDomainType());
	return new DefaultRevisionAwareJpaRepository(entityInformation, revisionEntityInformation, entityManager);
}
 
开发者ID:zakyalvan,项目名称:spring-envers-audit,代码行数:10,代码来源:RevisionAwareJpaRepositoryFactoryBean.java

示例8: getTargetRepository

import org.springframework.data.jpa.repository.support.SimpleJpaRepository; //导入依赖的package包/类
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
protected <T, ID extends Serializable> SimpleJpaRepository<?, ?> getTargetRepository(
        final RepositoryMetadata metadata, final EntityManager entityManager) {

    Class<?> repositoryInterface = metadata.getRepositoryInterface();

    JpaEntityInformation<?, Serializable> entityInformation = getEntityInformation(metadata.getDomainType());

    if (isQueryDslExecutor(repositoryInterface)) {
        return new QueryDslJpaRepository(entityInformation, entityManager);
    } else {
        return new GenericRepositoryImpl(entityInformation, entityManager, namedQueryUtil); // custom
    }
}
 
开发者ID:antoniomaria,项目名称:gazpachoquest,代码行数:16,代码来源:DefaultRepositoryFactory.java

示例9: getTargetRepository

import org.springframework.data.jpa.repository.support.SimpleJpaRepository; //导入依赖的package包/类
@Override
protected SimpleJpaRepository getTargetRepository(RepositoryInformation metadata) {
    return new BaseRepositoryImpl<T, I>((Class<T>) metadata.getDomainType(), entityManager);
}
 
开发者ID:geeker-lait,项目名称:tasfe-framework,代码行数:5,代码来源:BaseRepositoryFactoryBean.java

示例10: OrmCrudAdapter

import org.springframework.data.jpa.repository.support.SimpleJpaRepository; //导入依赖的package包/类
public OrmCrudAdapter(Class<T> entityType) {
    repository = new SimpleJpaRepository<>(entityType, getEntityManager());
}
 
开发者ID:snowdrop,项目名称:spring-data-snowdrop,代码行数:4,代码来源:JpaDatasourceMapper.java

示例11: getTargetRepository

import org.springframework.data.jpa.repository.support.SimpleJpaRepository; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected <T, ID extends Serializable> SimpleJpaRepository<?, ?> getTargetRepository(RepositoryMetadata metadata, EntityManager entityManager) {
	JpaEntityInformation<?, Serializable> entityInformation = getEntityInformation(metadata.getDomainType());
	return new GenericRepositoryImpl(entityInformation, entityManager);
}
 
开发者ID:onsoul,项目名称:ha-db,代码行数:7,代码来源:DefaultRepositoryFactory.java

示例12: getDelegate

import org.springframework.data.jpa.repository.support.SimpleJpaRepository; //导入依赖的package包/类
private synchronized SimpleJpaRepository<E, PK> getDelegate() {
    if (delegate == null) {
        delegate = new SimpleJpaRepository<E, PK>(getGenericType(), getEntityManager());
    }
    return delegate;
}
 
开发者ID:subes,项目名称:invesdwin-context-persistence,代码行数:7,代码来源:ACustomIdDao.java

示例13: JPABatchInsert

import org.springframework.data.jpa.repository.support.SimpleJpaRepository; //导入依赖的package包/类
public JPABatchInsert(final Class<E> genericType, final PersistenceUnitContext puContext) {
    this.em = puContext.getEntityManager();
    this.delegate = new SimpleJpaRepository<E, Long>(genericType, em);
    this.connectionBatchSize = puContext.getConnectionBatchSize();
}
 
开发者ID:subes,项目名称:invesdwin-context-persistence,代码行数:6,代码来源:JPABatchInsert.java

示例14: checkGeneratedRepositories

import org.springframework.data.jpa.repository.support.SimpleJpaRepository; //导入依赖的package包/类
@Test
public void checkGeneratedRepositories() throws Exception {
  assertThat(getTargetObject(employeeRepository)).isEqualTo(DataTablesRepositoryImpl.class);
  assertThat(getTargetObject(officeRepository)).isEqualTo(SimpleJpaRepository.class);
  assertThat(getTargetObject(qEmployeeRepository)).isEqualTo(QDataTablesRepositoryImpl.class);
}
 
开发者ID:darrachequesne,项目名称:spring-data-jpa-datatables,代码行数:7,代码来源:RepositoryTest.java

示例15: getTargetRepository

import org.springframework.data.jpa.repository.support.SimpleJpaRepository; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected <T, ID extends Serializable> SimpleJpaRepository<?, ?> getTargetRepository(RepositoryMetadata metadata, EntityManager entityManager)
{
	return new BaseRepositoryImpl(metadata.getDomainType(), entityManager);
}
 
开发者ID:danielme-com,项目名称:Spring-Data-JPA-Demo,代码行数:7,代码来源:BaseRepositoryFactoryBean.java


注:本文中的org.springframework.data.jpa.repository.support.SimpleJpaRepository类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。