本文整理汇总了Java中javax.persistence.criteria.SetJoin类的典型用法代码示例。如果您正苦于以下问题:Java SetJoin类的具体用法?Java SetJoin怎么用?Java SetJoin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SetJoin类属于javax.persistence.criteria包,在下文中一共展示了SetJoin类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: findByHarvestSeasonAndRhy
import javax.persistence.criteria.SetJoin; //导入依赖的package包/类
default HarvestQuota findByHarvestSeasonAndRhy(final long harvestSeasonId, final long rhyId) {
return findOne((root, query, cb) -> {
final Join<HarvestQuota, HarvestSeason> seasonToJoin = root.join(HarvestQuota_.harvestSeason, JoinType.LEFT);
final Predicate harvestSeasonPredicate = cb.equal(seasonToJoin.get(HarvestSeason_.id), harvestSeasonId);
final Join<HarvestQuota, HarvestArea> areaToJoin = root.join(HarvestQuota_.harvestArea, JoinType.LEFT);
final SetJoin<HarvestArea, Riistanhoitoyhdistys> rhysToJoin = areaToJoin.join(HarvestArea_.rhys, JoinType.LEFT);
final Predicate rhyPredicate = cb.equal(rhysToJoin.get(Organisation_.id), rhyId);
return cb.and(harvestSeasonPredicate, rhyPredicate);
});
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:13,代码来源:HarvestQuotaRepository.java
示例2: getBooks
import javax.persistence.criteria.SetJoin; //导入依赖的package包/类
@Test
public void getBooks() {
log.info("... getBooks ...");
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Book> cq = cb.createQuery(Book.class);
Root<Book> root = cq.from(Book.class);
SetJoin<Book, Author> authors = root.join(Book_.authors);
ParameterExpression<String> paramFirstName = cb.parameter(String.class);
ParameterExpression<String> paramLastName = cb.parameter(String.class);
cq.where(
cb.and(
cb.equal(authors.get(Author_.firstName), paramFirstName),
cb.equal(authors.get(Author_.lastName), paramLastName)));
TypedQuery<Book> query = em.createQuery(cq);
query.setParameter(paramFirstName, "Thorben");
query.setParameter(paramLastName, "Janssen");
List<Book> books = query.getResultList();
Assert.assertEquals(1, books.size());
for (Book b : books) {
log.info(b);
}
em.getTransaction().commit();
em.close();
}
开发者ID:thjanssen,项目名称:HibernateTips,代码行数:33,代码来源:TestCriteriaQuery.java
示例3: hasTags
import javax.persistence.criteria.SetJoin; //导入依赖的package包/类
/**
* {@link Specification} for retrieving {@link DistributionSet}s by "has at
* least one of the given tag names".
*
* @param tagNames
* to be filtered on
* @param selectDSWithNoTag
* flag to select distribution sets with no tag
* @return the {@link DistributionSet} {@link Specification}
*/
public static Specification<JpaDistributionSet> hasTags(final Collection<String> tagNames,
final Boolean selectDSWithNoTag) {
return (targetRoot, query, cb) -> {
final SetJoin<JpaDistributionSet, JpaDistributionSetTag> tags = targetRoot.join(JpaDistributionSet_.tags,
JoinType.LEFT);
final Predicate predicate = getPredicate(tags, tagNames, selectDSWithNoTag, cb);
query.distinct(true);
return predicate;
};
}
开发者ID:eclipse,项目名称:hawkbit,代码行数:21,代码来源:DistributionSetSpecification.java
示例4: getPredicate
import javax.persistence.criteria.SetJoin; //导入依赖的package包/类
private static Predicate getPredicate(final SetJoin<JpaDistributionSet, JpaDistributionSetTag> tags,
final Collection<String> tagNames, final Boolean selectDSWithNoTag, final CriteriaBuilder cb) {
tags.get(JpaDistributionSetTag_.name);
final Path<String> exp = tags.get(JpaDistributionSetTag_.name);
if (selectDSWithNoTag != null && selectDSWithNoTag) {
if (!CollectionUtils.isEmpty(tagNames)) {
return cb.or(exp.isNull(), exp.in(tagNames));
} else {
return exp.isNull();
}
} else {
return exp.in(tagNames);
}
}
开发者ID:eclipse,项目名称:hawkbit,代码行数:15,代码来源:DistributionSetSpecification.java
示例5: hasTag
import javax.persistence.criteria.SetJoin; //导入依赖的package包/类
/**
* {@link Specification} for retrieving {@link DistributionSet}s by tag.
*
* @param tagId
* the ID of the distribution set which must be assigned
* @return the {@link DistributionSet} {@link Specification}
*/
public static Specification<JpaDistributionSet> hasTag(final Long tagId) {
return (targetRoot, query, cb) -> {
final SetJoin<JpaDistributionSet, JpaDistributionSetTag> tags = targetRoot.join(JpaDistributionSet_.tags,
JoinType.LEFT);
return cb.equal(tags.get(JpaDistributionSetTag_.id), tagId);
};
}
开发者ID:eclipse,项目名称:hawkbit,代码行数:16,代码来源:DistributionSetSpecification.java
示例6: getPredicate
import javax.persistence.criteria.SetJoin; //导入依赖的package包/类
private static Predicate getPredicate(final Root<JpaTarget> targetRoot, final CriteriaBuilder cb,
final Boolean selectTargetWithNoTag, final String[] tagNames) {
final SetJoin<JpaTarget, JpaTargetTag> tags = targetRoot.join(JpaTarget_.tags, JoinType.LEFT);
final Path<String> exp = tags.get(JpaTargetTag_.name);
if (selectTargetWithNoTag) {
if (tagNames != null) {
return cb.or(exp.isNull(), exp.in(tagNames));
} else {
return exp.isNull();
}
} else {
return exp.in(tagNames);
}
}
开发者ID:eclipse,项目名称:hawkbit,代码行数:15,代码来源:TargetSpecifications.java
示例7: hasTag
import javax.persistence.criteria.SetJoin; //导入依赖的package包/类
/**
* {@link Specification} for retrieving {@link Target}s by tag.
*
* @param tagId
* the ID of the distribution set which must be assigned
* @return the {@link Target} {@link Specification}
*/
public static Specification<JpaTarget> hasTag(final Long tagId) {
return (targetRoot, query, cb) -> {
final SetJoin<JpaTarget, JpaTargetTag> tags = targetRoot.join(JpaTarget_.tags, JoinType.LEFT);
return cb.equal(tags.get(JpaTargetTag_.id), tagId);
};
}
开发者ID:eclipse,项目名称:hawkbit,代码行数:15,代码来源:TargetSpecifications.java
示例8: join
import javax.persistence.criteria.SetJoin; //导入依赖的package包/类
@Override
public <Y> SetJoin<X, Y> join(SetAttribute<? super X, Y> set) {
// TODO Auto-generated method stub
return null;
}
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:6,代码来源:MugglFrom.java
示例9: joinSet
import javax.persistence.criteria.SetJoin; //导入依赖的package包/类
@Override
public <X, Y> SetJoin<X, Y> joinSet(String attributeName) {
// TODO Auto-generated method stub
return null;
}
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:6,代码来源:MugglFrom.java
示例10: treat
import javax.persistence.criteria.SetJoin; //导入依赖的package包/类
@Override
public <X, T, E extends T> SetJoin<X, E> treat(SetJoin<X, T> join,
Class<E> type) {
// TODO Auto-generated method stub
return null;
}
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:7,代码来源:MugglCriteriaBuilder.java
示例11: treat
import javax.persistence.criteria.SetJoin; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <X, T, E extends T> SetJoin<X, E> treat(SetJoin<X, T> join, Class<E> type) {
// return ( (SetJoinImplementor) join ).treatAs( type );
throw new NotYetImplementedException( );
}
开发者ID:hibernate,项目名称:hibernate-semantic-query,代码行数:7,代码来源:CriteriaBuilderImpl.java
示例12: join
import javax.persistence.criteria.SetJoin; //导入依赖的package包/类
@Override
public <Y> SetJoin<T, Y> join( SetAttribute<? super T, Y> arg0 )
{
// TODO Auto-generated method stub
return null;
}
开发者ID:ltearno,项目名称:hexa.tools,代码行数:7,代码来源:RootImpl.java
示例13: joinSet
import javax.persistence.criteria.SetJoin; //导入依赖的package包/类
@Override
public <X, Y> SetJoin<X, Y> joinSet( String arg0 )
{
// TODO Auto-generated method stub
return null;
}
开发者ID:ltearno,项目名称:hexa.tools,代码行数:7,代码来源:RootImpl.java
示例14: hasTargetAssignedArtifact
import javax.persistence.criteria.SetJoin; //导入依赖的package包/类
/**
* Specification which joins all necessary tables to retrieve the dependency
* between a target and a local file assignment through the assigned action
* of the target. All actions are included, not only active actions.
*
* @param controllerId
* the target to verify if the given artifact is currently
* assigned or had been assigned
* @param sha1Hash
* of the local artifact to check wherever the target had ever
* been assigned
* @return a specification to use with spring JPA
*/
public static Specification<JpaAction> hasTargetAssignedArtifact(final String controllerId, final String sha1Hash) {
return (actionRoot, query, criteriaBuilder) -> {
final Join<JpaAction, JpaDistributionSet> dsJoin = actionRoot.join(JpaAction_.distributionSet);
final SetJoin<JpaDistributionSet, JpaSoftwareModule> modulesJoin = dsJoin.join(JpaDistributionSet_.modules);
final ListJoin<JpaSoftwareModule, JpaArtifact> artifactsJoin = modulesJoin
.join(JpaSoftwareModule_.artifacts);
return criteriaBuilder.and(criteriaBuilder.equal(artifactsJoin.get(JpaArtifact_.sha1Hash), sha1Hash),
criteriaBuilder.equal(actionRoot.get(JpaAction_.target).get(JpaTarget_.controllerId),
controllerId));
};
}
开发者ID:eclipse,项目名称:hawkbit,代码行数:25,代码来源:ActionSpecifications.java
注:本文中的javax.persistence.criteria.SetJoin类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论