本文整理匯總了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);
}