@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); }
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; }
@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); }
@Test public void repositoriesAreAssignedToAppropriateStores() { Repositories repositories = new Repositories(context); assertThat(repositories.getEntityInformationFor(Customer.class), is(instanceOf(JpaEntityInformation.class))); assertThat(repositories.getEntityInformationFor(Order.class), is(instanceOf(MongoEntityInformation.class))); }
SimpleExtendedQueryDslJpaRepository(JpaEntityInformation<T, ID> entityInformation, EntityManager entityManager) throws SQLException { super(entityInformation, entityManager, SimpleEntityPathResolver.INSTANCE); this.jpaQueryFactory = new JPAQueryFactory(HQLTemplates.DEFAULT, entityManager); this.path = SimpleEntityPathResolver.INSTANCE.createPath(entityInformation.getJavaType()); SQLTemplates sqlTemplates = getSQLServerTemplates(entityManager.getEntityManagerFactory()); this.jpaSqlFactory = () -> new JPASQLQuery<>(entityManager, sqlTemplates); this.entityManager = entityManager; }
@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); }
/** * Creates a new {@link CustomSimpleMaxedJpaRepository} to manage objects of the given {@link JpaEntityInformation}. * @param entityInformation must not be {@literal null}. * @param entityManager must not be {@literal null}. * @param maximumRecords maximum aantal records */ public CustomSimpleMaxedJpaRepository( final JpaEntityInformation<T, ?> entityInformation, final EntityManager entityManager, final int maximumRecords) { super(entityInformation, entityManager); em = entityManager; this.maximumRecords = maximumRecords; }
/** * Creates a new {@link CustomSimpleQuerycostJpaRepository} to manage objects of the given {@link JpaEntityInformation}. * @param entityInformation must not be {@literal null}. * @param entityManager must not be {@literal null}. * @param maxCostsQueryPlan maximum cost of a query plan */ CustomSimpleQuerycostJpaRepository( final JpaEntityInformation<T, ?> entityInformation, final EntityManager entityManager, final int maxCostsQueryPlan) { super(entityInformation, entityManager); this.em = entityManager; this.maxCostsQueryPlan = maxCostsQueryPlan; }
@Override public void setApplicationContext(ApplicationContext context) throws BeansException { Class<?>[] classes = GenericTypeResolver.resolveTypeArguments(this.getClass(), RepoBasedConverter.class); Class<?> clazz = classes[0]; this.repositories = new Repositories(context); this.entityInformation = (JpaEntityInformation<S, ID>) repositories.getEntityInformationFor(clazz); this.genericJpaRepository = (GenericJpaRepository<S, ID>) repositories.getRepositoryFor(clazz); this.useCache = genericJpaRepository instanceof CachingJpaRepository; }
public GenericJpaRepositoryImpl(JpaEntityInformation<T, ID> eif, EntityManager em) { super(eif, em); this.em = em; this.eif = eif; PropertyDescriptor descriptor = findFieldPropertyDescriptor(eif.getJavaType(), Status.class); isStatusAble = descriptor != null; if (isStatusAble) { statusReadMethod = descriptor.getReadMethod(); statusWriteMethod = descriptor.getWriteMethod(); } }
@Override protected <T, ID extends Serializable> JpaRepository<?, ?> getTargetRepository( RepositoryMetadata metadata, EntityManager entityManager) { JpaEntityInformation<?, Serializable> entityInformation = getEntityInformation(metadata .getDomainType()); return new GenericRepositoryImpl(entityInformation, entityManager); // custom // implementation }
public EntityGraphQuerydslRepository( JpaEntityInformation<T, ?> entityInformation, EntityManager entityManager) { super(entityInformation, entityManager); this.querydslJpaRepositoryDelegate = new EntityGraphAwareQuerydslJpaRepository<>( (JpaEntityInformation<T, ID>) entityInformation, entityManager); }
public EntityGraphQuerydslRepository( JpaEntityInformation<T, ID> entityInformation, EntityManager entityManager, EntityPathResolver resolver) { super(entityInformation, entityManager); this.querydslJpaRepositoryDelegate = new EntityGraphAwareQuerydslJpaRepository<>(entityInformation, entityManager, resolver); }
@SuppressWarnings({ "unchecked" }) protected Object getTargetRepository(RepositoryMetadata metadata) { JpaEntityInformation<T, Serializable> entityInformation = (JpaEntityInformation<T, Serializable>) getEntityInformation(metadata .getDomainType()); return new CalendarDTRepositoryImpl<T, ID>(entityInformation, entityManager); }
public CentromereJpaRepository(JpaEntityInformation<T, ID> entityInformation, EntityManager entityManager) { super(entityInformation, entityManager); this.metadata = entityInformation; this.entityManager = entityManager; this.queryBuilder = new JpaQueryBuilder<>(entityManager); }
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); }
@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); }
public DefaultRevisionAwareJpaRepository(JpaEntityInformation<T, ?> entityInformation, RevisionEntityInformation revisionEntityInformation, EntityManager entityManager) { super(entityInformation, entityManager); Assert.notNull(revisionEntityInformation); this.entityInformation = entityInformation; this.revisionEntityInformation = revisionEntityInformation; this.entityManager = entityManager; }
/** * Creates a new {@link SimpleJpaRepository} to manage objects of the given * {@link JpaEntityInformation}. */ public GenericRepositoryImpl(final JpaEntityInformation<T, ?> entityInformation, final EntityManager entityManager, final NamedQueryUtil namedQueryUtil) { super(entityInformation, entityManager); this.entityInformation = entityInformation; this.em = entityManager; // provider = // DefaultPersistenceProvider.fromEntityManager(entityManager); // this.springDataRepositoryInterface = springDataRepositoryInterface; this.namedQueryUtil = namedQueryUtil; this.byExampleSpecification = new ByExampleSpecification(entityManager); }
@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 } }
public GenericRepositoryImpl(JpaEntityInformation<E, ?> entityInformation, EntityManager entityManager) { super(entityInformation, entityManager); this.em = entityManager; }
@Autowired @SuppressWarnings("unchecked") public void setEntityManager(EntityManager em) { this.em = em; this.entityInfo = (JpaEntityInformation<T, ID>) JpaEntityInformationSupport.getEntityInformation(entityClass,em); }
public EntityGraphRepositoryImpl(JpaEntityInformation<T, I> entityInformation, EntityManager entityManager) { super(entityInformation, entityManager); this.entityManager = entityManager; this.domainClass = entityInformation.getJavaType(); }
public WiselyRepositoryImpl(JpaEntityInformation entityInformation, EntityManager entityManager) { super(entityInformation, entityManager); this.entityManager = entityManager; }
/** * Creates a new {@link CustomSimpleJpaRepository} to manage objects of the given {@link JpaEntityInformation}. * @param entityInformation must not be {@literal null}. * @param entityManager must not be {@literal null}. */ public CustomSimpleJpaRepository(final JpaEntityInformation<T, ?> entityInformation, final EntityManager entityManager) { super(entityInformation, entityManager); this.entityInformation = entityInformation; em = entityManager; }
public BasicRepositoryImpl(JpaEntityInformation entityInformation, EntityManager entityManager) { super(entityInformation, entityManager); this.entityManager = entityManager; }
/** 指定したエンティティの ID 値を取得します。 */ @SuppressWarnings("unchecked") public <T> Serializable idValue(T entity) { return ((JpaEntityInformation<T, Serializable>)OrmUtils.entityInformation(em, entity.getClass())).getId(entity); }
public BaseRepositoryImpl(final JpaEntityInformation<T, ID> entityInformation, final EntityManager entityManager) { super(entityInformation, entityManager); path = SimpleEntityPathResolver.INSTANCE.createPath(entityInformation.getJavaType()); final PathBuilder<T> builder = new PathBuilder<>(path.getType(), path.getMetadata()); this.querydsl = new Querydsl(entityManager, builder); }
@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); }
public BaseRepositoryImpl(JpaEntityInformation<T, ID> entityInformation, EntityManager entityManager) { super(entityInformation, entityManager); // Keep the EntityManager around to used from the newly introduced methods. this.entityManager = entityManager; this.entityInformation = entityInformation; }
public JpaSpecificationExecutorWithProjectionImpl(JpaEntityInformation entityInformation, EntityManager entityManager) { super(entityInformation, entityManager); this.entityManager = entityManager; this.entityInformation = entityInformation; }
public BaseRepositoryImpl(JpaEntityInformation<T, I> entityInformation, EntityManager entityManager) { super(entityInformation, entityManager); }
public TreeRepositoryImpl(JpaEntityInformation<T, I> entityInformation, EntityManager entityManager) { super(entityInformation, entityManager); }
public AclJpaRepository(JpaEntityInformation<T, ?> entityInformation, EntityManager entityManager, JpaSpecProvider<T> jpaSpecProvider) { super(entityInformation, entityManager); this.jpaSpecProvider = jpaSpecProvider; }
public GenericJpaRepositoryImpl(JpaEntityInformation<T, ?> entityInformation, EntityManager entityManager){ super(entityInformation, entityManager); this.entityInformation = entityInformation; this.entityManager = entityManager; }
public JpaEntityInformation<T, ?> getEntityInformation() { return entityInformation; }
public ByIdSpecification(JpaEntityInformation<T, ?> entityInformation, ID id) { this.entityInformation = entityInformation; this.id = id; }
public ByIdsSpecification(JpaEntityInformation<T, ?> entityInformation) { this.entityInformation = entityInformation; }
public PlatformJpaRepositoryImpl(JpaEntityInformation<T, ?> entityInformation, EntityManager entityManager) { super(entityInformation, entityManager); this.entityManager = entityManager; }