本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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
}
}
示例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);
}
示例10: OrmCrudAdapter
import org.springframework.data.jpa.repository.support.SimpleJpaRepository; //导入依赖的package包/类
public OrmCrudAdapter(Class<T> entityType) {
repository = new SimpleJpaRepository<>(entityType, getEntityManager());
}
示例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);
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}