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


Java Subqueries类代码示例

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


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

示例1: getAllPluginPropertiesForBatchInstance

import org.hibernate.criterion.Subqueries; //导入依赖的package包/类
/**
 * API to get all plugin properties for Batch instance.
 * 
 * @param batchInstanceIdentifier {@link String}
 * @return List<BatchClassPluginConfig> 
 */
@Override
public List<BatchClassPluginConfig> getAllPluginPropertiesForBatchInstance(String batchInstanceIdentifier) {
	DetachedCriteria criteria = criteria();
	criteria.createAlias(BATCH_CLASS_PLUGIN, BATCH_CLASS_PLUGIN);
	criteria.createAlias(BATCH_CLASS_PLUGIN_BATCH_CLASS_MODULE, BATCH_CLASS_MODULE);
	criteria.createAlias("batchClassModule.batchClass", BATCH_CLASS);

	DetachedCriteria subQuery = criteria(BatchInstance.class);
	subQuery.add(Restrictions.eq("identifier", batchInstanceIdentifier));
	subQuery.setProjection(Projections.property("batchClass.id"));

	criteria.add(Subqueries.propertyEq("batchClass.id", subQuery));

	return find(criteria);
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:22,代码来源:BatchClassPluginConfigDaoImpl.java

示例2: getBatchClassList

import org.hibernate.criterion.Subqueries; //导入依赖的package包/类
/**
 * API to get the list of Batch Classes specifying startindex, no of results and sorting if any.
 * 
 * @param firstResult int
 * @param maxResults int 
 * @param order List<Order>
 * @param userRoles Set<String>
 * @return List of batch class.
 */
@Override
public List<BatchClass> getBatchClassList(final int firstResult, final int maxResults, final List<Order> order,
		final Set<String> userRoles) {
	EphesoftCriteria criteria = criteria();
	List<BatchClass> batchClassList = null;
	if (userRoles == null) {
		batchClassList = new ArrayList<BatchClass>(0);
	} else {
		List<String> roleList = new ArrayList<String>();
		for (String userRole : userRoles) {
			if (null == userRole || userRole.isEmpty()) {
				continue;
			}
			roleList.add(userRole);
		}
		DetachedCriteria detachedCriteria = criteria();
		detachedCriteria.createAlias(ASSIGNED_GROUPS, ASSIGNED_GROUPS);
		detachedCriteria.add(Restrictions.in(ASSIGNED_GROUPS_NAME, roleList));
		detachedCriteria.setProjection(Projections.distinct(Projections.property(BATCH_ID)));
		criteria.add(Subqueries.propertyIn(BATCH_ID, detachedCriteria));
		criteria.add(Restrictions.or(Restrictions.isNull(IS_DELETED), Restrictions.eq(IS_DELETED, false)));
		batchClassList = find(criteria, firstResult, maxResults, order.toArray(new Order[order.size()]));
	}
	return batchClassList;
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:35,代码来源:BatchClassDaoImpl.java

示例3: createCriteria

import org.hibernate.criterion.Subqueries; //导入依赖的package包/类
public Criteria createCriteria()
{      
  DetachedCriteria crit = createSerializableCriteria();
  crit.setProjection(
      Projections.distinct(
          Projections.property("glycanSequenceId")));
  
  Criteria criteria = getEntityManager().createQuery(GlycanSequence.class);
  
  criteria.add( Subqueries.propertyIn("glycanSequenceId",crit) );
  
  if( getIndex() != null ) 
  {
      getIndex().apply(criteria);
  }
  
  return criteria;
}
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:19,代码来源:SearchGlycanSequence.java

示例4: getAllDynamicPluginPropertiesForBatchInstance

import org.hibernate.criterion.Subqueries; //导入依赖的package包/类
/**
 * To get all Dynamic Plugin Properties for Batch instance.
 * 
 * @param batchClassIdentifier String
 * @return List<BatchClassDynamicPluginConfig>
 */
@Override
public List<BatchClassDynamicPluginConfig> getAllDynamicPluginPropertiesForBatchInstance(String batchInstanceIdentifier) {
	DetachedCriteria criteria = criteria();
	criteria.createAlias(BATCH_CLASS_PLUGIN, BATCH_CLASS_PLUGIN);
	criteria.createAlias(BATCH_CLASS_PLUGIN_BATCH_CLASS_MODULE, BATCH_CLASS_MODULE);
	criteria.createAlias("batchClassModule.batchClass", BATCH_CLASS);

	DetachedCriteria subQuery = criteria(BatchInstance.class);
	subQuery.add(Restrictions.eq("identifier", batchInstanceIdentifier));
	subQuery.setProjection(Projections.property("batchClass.id"));

	criteria.add(Subqueries.propertyEq("batchClass.id", subQuery));

	return find(criteria);
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:22,代码来源:BatchClassDynamicPluginConfigDaoImpl.java

示例5: getFdTypeByDocTypeNameForBatchInstance

import org.hibernate.criterion.Subqueries; //导入依赖的package包/类
/**
 * An API to fetch all Field types by document type name.
 * 
 * @param docTypeName String
 * @param batchInstanceIdentifierIdentifier String
 * @return List<FieldType>
 */
@Override
public List<FieldType> getFdTypeByDocTypeNameForBatchInstance(String docTypeName, String batchInstanceIdentifier) {

	LOG.info("batchInstanceID  : " + batchInstanceIdentifier);
	DetachedCriteria criteria = criteria();
	criteria.createAlias(DOC_TYPE, DOC_TYPE, JoinFragment.INNER_JOIN);
	criteria.add(Restrictions.eq(DOC_TYPE_NAME, docTypeName));
	criteria.createAlias(DOC_TYPE_BATCH_CLASS, BATCH_CLASS1, JoinFragment.INNER_JOIN);
	DetachedCriteria subQuery = criteria(BatchInstance.class);
	subQuery.add(Restrictions.eq(IDENTIFIER, batchInstanceIdentifier));
	subQuery.createAlias(BATCH_CLASS, BATCH_CLASS2, JoinFragment.INNER_JOIN);
	subQuery.setProjection(Projections.property(BATCH_CLASS2_IDENTIFIER));
	criteria.add(Subqueries.propertyEq(BATCH_CLASS1_IDENTIFIER, subQuery));
	criteria.addOrder(org.hibernate.criterion.Order.asc(FIELD_ORDER_NUMBER));

	return find(criteria);

}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:26,代码来源:FieldTypeDaoImpl.java

示例6: getFieldType

import org.hibernate.criterion.Subqueries; //导入依赖的package包/类
/**
 * An API to get field type for a batch for a particular document.
 *  
 * @param fieldTypeName String
 * @param docTypeName String
 * @param batchInstanceIdentifier String
 * @return FieldType
 */
@Override
public FieldType getFieldType(String fieldTypeName, String docTypeName, String batchInstanceIdentifier) {

	LOG.info("batchInstanceID  : " + batchInstanceIdentifier);
	DetachedCriteria criteria = criteria();
	criteria.add(Restrictions.eq(NAME, fieldTypeName));
	criteria.createAlias(DOC_TYPE, DOC_TYPE, JoinFragment.INNER_JOIN);
	criteria.add(Restrictions.eq(DOC_TYPE_NAME, docTypeName));
	criteria.createAlias(DOC_TYPE_BATCH_CLASS, BATCH_CLASS1, JoinFragment.INNER_JOIN);
	DetachedCriteria subQuery = criteria(BatchInstance.class);
	subQuery.add(Restrictions.eq(IDENTIFIER, batchInstanceIdentifier));
	subQuery.createAlias(BATCH_CLASS, BATCH_CLASS2, JoinFragment.INNER_JOIN);
	subQuery.setProjection(Projections.property(BATCH_CLASS2_IDENTIFIER));
	criteria.add(Subqueries.propertyEq(BATCH_CLASS1_IDENTIFIER, subQuery));

	return findSingle(criteria);

}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:27,代码来源:FieldTypeDaoImpl.java

示例7: getFdTypeByDocumentTypeName

import org.hibernate.criterion.Subqueries; //导入依赖的package包/类
/**
 * An API to fetch all Field types by document type name.
 * 
 * @param docTypeName String
 * @param batchInstanceIdentifier String
 * @param isKVExtraction boolean
 * @return List<FieldType>
 */
@Override
public List<FieldType> getFdTypeByDocumentTypeName(String docTypeName, String batchInstanceIdentifier, boolean isKVExtraction) {
	LOG.info("batchInstanceID ID  : " + batchInstanceIdentifier);
	DetachedCriteria criteria = criteria();
	criteria.createAlias(DOC_TYPE, DOC_TYPE, JoinFragment.INNER_JOIN);
	criteria.add(Restrictions.eq(DOC_TYPE_NAME, docTypeName));
	criteria.createAlias(DOC_TYPE_BATCH_CLASS, BATCH_CLASS1, JoinFragment.INNER_JOIN);

	if (isKVExtraction) {
		criteria.setFetchMode("kvExtraction", FetchMode.JOIN);
		criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
	}

	DetachedCriteria subQuery = criteria(BatchInstance.class);
	subQuery.add(Restrictions.eq(IDENTIFIER, batchInstanceIdentifier));
	subQuery.createAlias(BATCH_CLASS, BATCH_CLASS2, JoinFragment.INNER_JOIN);
	subQuery.setProjection(Projections.property(BATCH_CLASS2_IDENTIFIER));
	criteria.add(Subqueries.propertyEq(BATCH_CLASS1_IDENTIFIER, subQuery));
	criteria.addOrder(org.hibernate.criterion.Order.asc(FIELD_ORDER_NUMBER));
	return find(criteria);
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:30,代码来源:FieldTypeDaoImpl.java

示例8: getFdTypeAndRegexValidationByDocTypeName

import org.hibernate.criterion.Subqueries; //导入依赖的package包/类
/**
 * An API to fetch all Field types by document type name.
 * 
 * @param docTypeName String
 * @param batchInstanceIdentifier String
 * @return List<FieldType>
 */
@Override
public List<FieldType> getFdTypeAndRegexValidationByDocTypeName(String docTypeName, String batchInstanceIdentifier) {

	LOG.info("batchInstanceID ID  : " + batchInstanceIdentifier);
	DetachedCriteria criteria = criteria();
	criteria.createAlias(DOC_TYPE, DOC_TYPE, JoinFragment.INNER_JOIN);
	criteria.add(Restrictions.eq(DOC_TYPE_NAME, docTypeName));
	criteria.createAlias(DOC_TYPE_BATCH_CLASS, BATCH_CLASS1, JoinFragment.INNER_JOIN);

	criteria.setFetchMode(REGEX_VALIDATION, FetchMode.JOIN);
	criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);

	DetachedCriteria subQuery = criteria(BatchInstance.class);
	subQuery.add(Restrictions.eq(IDENTIFIER, batchInstanceIdentifier));
	subQuery.createAlias(BATCH_CLASS, BATCH_CLASS2, JoinFragment.INNER_JOIN);
	subQuery.setProjection(Projections.property(BATCH_CLASS2_IDENTIFIER));
	criteria.add(Subqueries.propertyEq(BATCH_CLASS1_IDENTIFIER, subQuery));
	criteria.addOrder(org.hibernate.criterion.Order.asc(FIELD_ORDER_NUMBER));

	return find(criteria);

}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:30,代码来源:FieldTypeDaoImpl.java

示例9: getPageTypeByName

import org.hibernate.criterion.Subqueries; //导入依赖的package包/类
/**
 * An API to fetch page type by page type name.
 * 
 * @param name String
 * @param batchInstanceIdentifier String
 * @return List<PageType>
 */
@Override
public List<PageType> getPageTypeByName(String name, String batchInstanceIdentifier) {
	DetachedCriteria criteria = criteria();
	criteria.add(Restrictions.eq(NAME, name));
	if (null != batchInstanceIdentifier) {
		criteria.createAlias(DOC_TYPE, DOC_TYPE, JoinFragment.INNER_JOIN);
		criteria.createAlias(DOC_TYPE_BATCH_CLASS, BATCH_CLASS1, JoinFragment.INNER_JOIN);
		DetachedCriteria subQuery = criteria(BatchInstance.class);
		subQuery.add(Restrictions.eq(IDENTIFIER, batchInstanceIdentifier));
		subQuery.createAlias(BATCH_CLASS, BATCH_CLASS2, JoinFragment.INNER_JOIN);
		subQuery.setProjection(Projections.property(BATCH_CLASS2_IDENTIFIER));
		criteria.add(Subqueries.propertyEq(BATCH_CLASS1_IDENTIFIER, subQuery));
	}
	return find(criteria);
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:23,代码来源:PageTypeDaoImpl.java

示例10: getPluginPropertiesForBatch

import org.hibernate.criterion.Subqueries; //导入依赖的package包/类
/**
 * API to get plugin properties for Batch.
 * 
 * @param batchInstanceIdentifier {@link String}
 * @param pluginName {@link String}
 * @return List<BatchClassPluginConfig> 
 */
@Override
public List<BatchClassPluginConfig> getPluginPropertiesForBatch(String batchInstanceIdentifier, String pluginName) {

	DetachedCriteria criteria = criteria();
	criteria.createAlias(BATCH_CLASS_PLUGIN, BATCH_CLASS_PLUGIN, JoinFragment.INNER_JOIN);
	criteria.createAlias(BATCH_CLASS_PLUGIN_BATCH_CLASS_MODULE, BATCH_CLASS_MODULE, JoinFragment.INNER_JOIN);
	criteria.createAlias(BATCH_CLASS_PLUGIN_BATCH_CLASS_MODULE_BATCH_CLASS, BATCH_CLASS, JoinFragment.INNER_JOIN);
	criteria.createAlias(BATCH_CLASS_PLUGIN_PLUGIN, PLUGIN, JoinFragment.INNER_JOIN);
	criteria.add(Restrictions.eq(PLUGIN_PLUGIN_NAME, pluginName));
	DetachedCriteria subQuery = criteria(BatchInstance.class);
	subQuery.add(Restrictions.eq("identifier", batchInstanceIdentifier));
	subQuery.createAlias(BATCH_CLASS, "batchClass1", JoinFragment.INNER_JOIN);
	subQuery.setProjection(Projections.property("batchClass1.identifier"));
	criteria.add(Subqueries.propertyEq(BATCH_CLASS_IDENTIFIER, subQuery));
	return find(criteria);

}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:25,代码来源:BatchClassPluginConfigDaoImpl.java

示例11: getTweetByOwnerId

import org.hibernate.criterion.Subqueries; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<Tweet> getTweetByOwnerId(String ownerId){
	
	DetachedCriteria dcr = DetachedCriteria.forClass(User.class, "follower");
	dcr.createAlias("follower.following", "following");
	dcr.add(Restrictions.eq("follower.id", ownerId));
	dcr.setProjection(Projections.property("following.id"));
	
	Criteria cr = getSession().createCriteria(Tweet.class, "tweets");
	
	Disjunction res = Restrictions.disjunction();
	res.add(Restrictions.eq("ownerId", ownerId));
	res.add(Subqueries.propertyIn("tweets.ownerId", dcr));
	
	cr.add(res);		
	return cr.list();
}
 
开发者ID:boyusun,项目名称:MiniTwitter,代码行数:18,代码来源:TweetDAOImpl.java

示例12: getFollowerByuserId

import org.hibernate.criterion.Subqueries; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<User> getFollowerByuserId(String userId){
	
	// criteria query is suitable for dynamically creating queries, easier to use;
	Criteria cr = getSession().createCriteria(User.class, "user");

	DetachedCriteria dcr = DetachedCriteria.forClass(User.class, "following");
	dcr.createAlias("following.follower", "follower");
	dcr.add(Restrictions.eq("following.id", userId));
	dcr.setProjection(Projections.property("follower.id"));

	cr.add(Subqueries.propertyIn("user.id", dcr));
	return cr.list();
	
	
	// HQL resembles SQL language, is suitable for complex queries, more flexible;
	/**return getSession().createQuery("select user "
									+ "from User user "
									+ "where user.id in "
										+ "(select follower.id "
										+ "from User following "
										+ "inner join following.follower follower "
										+ "where following.id = :userId)")
						.setParameter("userId", userId)
						.list();*/
}
 
开发者ID:boyusun,项目名称:MiniTwitter,代码行数:27,代码来源:UserDAOImpl.java

示例13: getCriteria

import org.hibernate.criterion.Subqueries; //导入依赖的package包/类
public DetachedCriteria getCriteria() {
    if (m_criteria == null) {
        throw new IllegalStateException("Unable to determine Class<?> of this criteria!");
    }

    for (final Criterion criterion : m_criterions) {
        m_criteria.add(criterion);
    }

    if (m_distinct) {
        m_criteria.setProjection(Projections.distinct(Projections.id()));

        final DetachedCriteria newCriteria = DetachedCriteria.forClass(m_class);
        newCriteria.add(Subqueries.propertyIn("id", m_criteria));

        m_criteria = newCriteria;
    }

    for (final org.hibernate.criterion.Order order : m_orders) {
        m_criteria.addOrder(order);
    }

    return m_criteria;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:25,代码来源:HibernateCriteriaConverter.java

示例14: visitCountExpression

import org.hibernate.criterion.Subqueries; //导入依赖的package包/类
/**
 * Corresponds to the sub-select
 * 
 * <pre>
 * sub-criterion + group-by-having count([distinct] id)
 * op count
 * </pre>
 * 
 * .
 * 
 * @see <code>LTestHibernateCount</code>
 */
public void visitCountExpression()
{
	// TODO: move projection code to ProjectionFactoryHibernateImpl for more
	// generic sub-select support (after we add more sub-select types in
	// addition to COUNT)
	final String idPropertyName = classMetadata.getIdentifierPropertyName();
	final CountProjectionParams projectionParams = CountProjectionParams.newInstance(
			this, criterion);
	final DetachedCriteria subQuery = createCountSubQuery().setProjection(
			CustomProjections.groupByHaving(idPropertyName, CustomProjections
					.countProjection(projectionParams.propertyName,
							projectionParams.distinct), projectionParams.relation,
					projectionParams.value));

	// Main criterion: ID in (result of sub-query)
	result = Subqueries.propertyIn(classMetadata.getIdentifierPropertyName(),
			subQuery);
}
 
开发者ID:openfurther,项目名称:further-open-core,代码行数:31,代码来源:CriterionBuilderHibernateImpl.java

示例15: getAllOrganisationsForNomWithoutCalendar

import org.hibernate.criterion.Subqueries; //导入依赖的package包/类
/**
 * Get the list of Organisation that has not a calendar defined
 * 
 * @author Adelina	
 * @return List<Organisation>
 */
public List<Organisation> getAllOrganisationsForNomWithoutCalendar(){
	logger.debug("getAllOrganisationsForNomWithoutCalendar - START");
	
	DetachedCriteria dc = DetachedCriteria.forEntityName(IModelConstant.organisationForNomEntity);			
	dc.addOrder(Order.asc("name"));		
	DetachedCriteria subquery = DetachedCriteria.forEntityName(IModelConstant.calendarEntity);		
	subquery.setProjection(Projections.property("organisation.organisationId"));		
	dc.add(Subqueries.propertyNotIn("organisationId", subquery));		
	
	List organisations = getHibernateTemplate().findByCriteria(dc);
	
	logger.debug("getAllOrganisationsForNomWithoutCalendar - END - ".concat(String.valueOf(organisations.size())));
	return organisations;
					
}
 
开发者ID:CodeSphere,项目名称:termitaria,代码行数:22,代码来源:DaoOrganisationImpl.java


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