当前位置: 首页>>代码示例>>Java>>正文


Java SetAttribute类代码示例

本文整理汇总了Java中javax.persistence.metamodel.SetAttribute的典型用法代码示例。如果您正苦于以下问题:Java SetAttribute类的具体用法?Java SetAttribute怎么用?Java SetAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SetAttribute类属于javax.persistence.metamodel包,在下文中一共展示了SetAttribute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: join

import javax.persistence.metamodel.SetAttribute; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Nonnull
public static <T, U> Join<T, U> join(
        @Nonnull final From<?, T> from, @Nonnull final PluralAttribute<? super T, ?, U> attribute) {

    Objects.requireNonNull(from, "from is null");
    Objects.requireNonNull(attribute, "attribute is null");

    if (attribute instanceof CollectionAttribute) {
        return from.join((CollectionAttribute<T, U>) attribute);
    }
    if (attribute instanceof SetAttribute) {
        return from.join((SetAttribute<T, U>) attribute);
    }
    if (attribute instanceof ListAttribute) {
        return from.join((ListAttribute<T, U>) attribute);
    }
    if (attribute instanceof MapAttribute) {
        return from.join((MapAttribute<T, ?, U>) attribute);
    }

    // Should never end up here.
    throw new IllegalArgumentException();
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:25,代码来源:CriteriaUtils.java

示例2: createOrGetJoin

import javax.persistence.metamodel.SetAttribute; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected SetJoin<UserEntity, ExtensionFieldValueEntity> createOrGetJoin(String alias, Root<UserEntity> root,
                                                                         SetAttribute<UserEntity, ExtensionFieldValueEntity> attribute) {

    for (Join<UserEntity, ?> currentJoin : root.getJoins()) {
        if (currentJoin.getAlias() == null) {
            // if alias is null, it is not an alias for an extension join, so we ignore it
            continue;
        }

        if (currentJoin.getAlias().equals(alias)) {
            return (SetJoin<UserEntity, ExtensionFieldValueEntity>) currentJoin;
        }
    }

    final SetJoin<UserEntity, ExtensionFieldValueEntity> join = root.join(attribute, JoinType.LEFT);

    join.alias(alias);

    return join;
}
 
开发者ID:osiam,项目名称:osiam,代码行数:22,代码来源:ExtensionQueryField.java

示例3: castGet

import javax.persistence.metamodel.SetAttribute; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private <V> Expression<?> castGet(final Attribute<K, V> attribute, Join<E, K> join)
{
	if (attribute instanceof SingularAttribute)
	{
		return join.get((SingularAttribute<K, V>) attribute);
	}
	else if (attribute instanceof ListAttribute)
	{
		return join.get((ListAttribute<K, V>) attribute);
	}
	else if (attribute instanceof SetAttribute)
	{
		return join.get((SetAttribute<K, V>) attribute);
	}
	else
	{
		return null;
	}
}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:21,代码来源:JoinBuilder.java

示例4: copyJoins

import javax.persistence.metamodel.SetAttribute; //导入依赖的package包/类
/**
 * @return last possibly used alias
 */
private int copyJoins(From<?, ?> from, From<?, ?> to, int counter) {
    for (Join<?, ?> join : sort(comparator, from.getJoins())) {
        Attribute<?, ?> attr = join.getAttribute();
        // Hibern fails with String-bases api; Join.join(String, JoinType)
        @SuppressWarnings({ "rawtypes", "unchecked" })
        Join<Object, Object> j = attr instanceof SingularAttribute ? to.join((SingularAttribute) join.getAttribute(), join.getJoinType()) :
            attr instanceof CollectionAttribute ? to.join((CollectionAttribute) join.getAttribute(), join.getJoinType()) :
            attr instanceof SetAttribute ? to.join((SetAttribute) join.getAttribute(), join.getJoinType()) :
            attr instanceof ListAttribute ? to.join((ListAttribute) join.getAttribute(), join.getJoinType()) :
            attr instanceof MapAttribute ? to.join((MapAttribute) join.getAttribute(), join.getJoinType()) :
            to.join((CollectionAttribute) join.getAttribute(), join.getJoinType());
        copyAlias(join, j, ++counter);
        counter = copyJoins(join, j, ++counter);
    }
    copyFetches(from, to);
    return counter;
}
 
开发者ID:solita,项目名称:query-utils,代码行数:21,代码来源:JpaCriteriaCopy.java

示例5: inCollection

import javax.persistence.metamodel.SetAttribute; //导入依赖的package包/类
@Nonnull
public static <T, U> Specification<T> inCollection(
        @Nonnull final SetAttribute<? super T, U> setAttribute, @Nullable final Collection<U> values) {

    Objects.requireNonNull(setAttribute, "setAttribute must not be null");

    return (root, query, cb) -> JpaPreds.inCollection(cb, root.join(setAttribute), values);
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:9,代码来源:JpaSpecs.java

示例6: join

import javax.persistence.metamodel.SetAttribute; //导入依赖的package包/类
@Override
	public <Y> JpaSetJoin<X, Y> join(SetAttribute<? super X, Y> set, JoinType jt) {
//		if ( !canBeJoinSource() ) {
//			throw illegalJoin();
//		}
//
//		final SetJoin<X, Y> join = constructJoin( set, jt );
//		joinScope.addJoin( join );
//		return join;

		throw new NotYetImplementedException(  );
	}
 
开发者ID:hibernate,项目名称:hibernate-semantic-query,代码行数:13,代码来源:AbstractFromImpl.java

示例7: joinSet

import javax.persistence.metamodel.SetAttribute; //导入依赖的package包/类
@Override
@SuppressWarnings({"unchecked"})
public <X, Y> JpaSetJoin<X, Y> joinSet(String attributeName, JoinType jt) {
	final Attribute<X, ?> attribute = (Attribute<X, ?>) locateAttribute( attributeName );
	if ( !attribute.isCollection() ) {
		throw new IllegalArgumentException( "Requested attribute was not a set" );
	}

	final PluralAttribute pluralAttribute = (PluralAttribute) attribute;
	if ( !PluralAttribute.CollectionType.SET.equals( pluralAttribute.getCollectionType() ) ) {
		throw new IllegalArgumentException( "Requested attribute was not a set" );
	}

	return (JpaSetJoin<X, Y>) join( (SetAttribute) attribute, jt );
}
 
开发者ID:hibernate,项目名称:hibernate-semantic-query,代码行数:16,代码来源:AbstractFromImpl.java

示例8: countUsersWithMetaData

import javax.persistence.metamodel.SetAttribute; //导入依赖的package包/类
long countUsersWithMetaData(T entity, SetAttribute<User, T> attribute) {
    CriteriaBuilder cb = em.getCriteriaBuilder();
    CriteriaQuery<Long> query = cb.createQuery(Long.class);
    Root<User> root = query.from(User.class);
    Join<User, T> join = root.join(attribute);
    query.where(join.in(entity));
    query.select(cb.countDistinct(root));
    return em.createQuery(query).getSingleResult();
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:10,代码来源:MetaDataService.java

示例9: countQOWithMetaData

import javax.persistence.metamodel.SetAttribute; //导入依赖的package包/类
long countQOWithMetaData(T entity, SetAttribute<QMBaseIndicator, QModelTagData> attribute) {
    CriteriaBuilder cb = em.getCriteriaBuilder();
    CriteriaQuery<Long> query = cb.createQuery(Long.class);
    Root<QMQualityObjective> root = query.from(QMQualityObjective.class);
    Join<QMQualityObjective, QModelTagData> join = root.join(attribute);
    query.where(join.get(QModelTagData_.tagId).in(entity.getId()));
    query.select(cb.countDistinct(root));
    return em.createQuery(query).getSingleResult();
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:10,代码来源:MetaDataService.java

示例10: countQIWithMetaData

import javax.persistence.metamodel.SetAttribute; //导入依赖的package包/类
long countQIWithMetaData(T entity, SetAttribute<QMBaseIndicator, QModelTagData> attribute) {
    CriteriaBuilder cb = em.getCriteriaBuilder();
    CriteriaQuery<Long> query = cb.createQuery(Long.class);
    Root<QMQualityIndicator> root = query.from(QMQualityIndicator.class);
    Join<QMQualityIndicator, QModelTagData> join = root.join(attribute);
    query.where(join.get(QModelTagData_.tagId).in(entity.getId()));
    query.select(cb.countDistinct(root));
    return em.createQuery(query).getSingleResult();
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:10,代码来源:MetaDataService.java

示例11: countQMetricWithMetaData

import javax.persistence.metamodel.SetAttribute; //导入依赖的package包/类
long countQMetricWithMetaData(T entity, SetAttribute<QMBaseIndicator, QModelTagData> attribute) {
    CriteriaBuilder cb = em.getCriteriaBuilder();
    CriteriaQuery<Long> query = cb.createQuery(Long.class);
    Root<QMMetric> root = query.from(QMMetric.class);
    Join<QMMetric, QModelTagData> join = root.join(attribute);
    query.where(join.get(QModelTagData_.tagId).in(entity.getId()));
    query.select(cb.countDistinct(root));
    return em.createQuery(query).getSingleResult();
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:10,代码来源:MetaDataService.java

示例12: countprojectsWithMetaData

import javax.persistence.metamodel.SetAttribute; //导入依赖的package包/类
long countprojectsWithMetaData(T entity, SetAttribute<Project, T> attribute) {
    CriteriaBuilder cb = em.getCriteriaBuilder();
    CriteriaQuery<Long> query = cb.createQuery(Long.class);
    Root<Project> root = query.from(Project.class);
    Join<Project, T> join = root.join(attribute);
    query.where(join.in(entity));
    query.select(cb.countDistinct(root));
    return em.createQuery(query).getSingleResult();
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:10,代码来源:MetaDataService.java

示例13: getUsersWithMetaData

import javax.persistence.metamodel.SetAttribute; //导入依赖的package包/类
List<User> getUsersWithMetaData(T entity, SetAttribute<User, T> attribute) {
    CriteriaBuilder cb = em.getCriteriaBuilder();
    CriteriaQuery<User> query = cb.createQuery(User.class);
    Root<User> root = query.from(User.class);
    Join<User, T> join = root.join(attribute);
    query.where(join.in(entity));
    return em.createQuery(query).getResultList();
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:9,代码来源:MetaDataService.java

示例14: getProjectsWithMetaData

import javax.persistence.metamodel.SetAttribute; //导入依赖的package包/类
List<Project> getProjectsWithMetaData(T entity, SetAttribute<Project, T> attribute) {
    CriteriaBuilder cb = em.getCriteriaBuilder();
    CriteriaQuery<Project> query = cb.createQuery(Project.class);
    Root<Project> root = query.from(Project.class);
    Join<Project, T> join = root.join(attribute);
    query.where(join.in(entity));
    return em.createQuery(query).getResultList();
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:9,代码来源:MetaDataService.java

示例15: getQOWithMetaData

import javax.persistence.metamodel.SetAttribute; //导入依赖的package包/类
private List<QMQualityObjective> getQOWithMetaData(T entity, SetAttribute<QMBaseIndicator, QModelTagData> attribute) {
    CriteriaBuilder cb = em.getCriteriaBuilder();
    CriteriaQuery<QMQualityObjective> query = cb.createQuery(QMQualityObjective.class);
    Root<QMQualityObjective> root = query.from(QMQualityObjective.class);
    Join<QMQualityObjective, QModelTagData> join = root.join(attribute);
    query.where(join.get(QModelTagData_.tagId).in(entity.getId()));
    return em.createQuery(query).getResultList();
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:9,代码来源:MetaDataService.java


注:本文中的javax.persistence.metamodel.SetAttribute类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。