當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。