當前位置: 首頁>>代碼示例>>Java>>正文


Java Query.setBoolean方法代碼示例

本文整理匯總了Java中org.hibernate.Query.setBoolean方法的典型用法代碼示例。如果您正苦於以下問題:Java Query.setBoolean方法的具體用法?Java Query.setBoolean怎麽用?Java Query.setBoolean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.hibernate.Query的用法示例。


在下文中一共展示了Query.setBoolean方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateDeleted

import org.hibernate.Query; //導入方法依賴的package包/類
@Override
public Boolean updateDeleted(List<Integer> ids, boolean deleted) {
    String hql = "update MoFeatured set Deleted =:deleted where id in (:ids)";
    Query query = getSession().createQuery(hql);
    query.setBoolean("deleted", deleted);
    query.setParameterList("ids", ids);
    return query.executeUpdate() > 0;
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:9,代碼來源:MoFeaturedDaoImpl.java

示例2: findAll

import org.hibernate.Query; //導入方法依賴的package包/類
public static List<TimePattern> findAll(Long sessionId, Boolean visible) {
	String query = "from TimePattern tp " +
				 	"where tp.session.uniqueId=:sessionId";
	if (visible!=null) 
	    query += " and visible=:visible";
	
	org.hibernate.Session hibSession = new TimePatternDAO().getSession();
	Query q = hibSession.createQuery(query);
	q.setCacheable(true);
	q.setLong("sessionId", sessionId.longValue());
	if (visible!=null) 
	    q.setBoolean("visible", visible.booleanValue());
	
    List<TimePattern> v = q.list();
    Collections.sort(v);
    return v;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:18,代碼來源:TimePattern.java

示例3: queryList

import org.hibernate.Query; //導入方法依賴的package包/類
/**
 * @param marketName
 *            :市場名稱
 * @param status
 *            :是否可以 true為可以 ,false不可以禁用,不用再監控了。
 */
@Override
public List<MonUserChannelApp> queryList(String marketName, Boolean status) {
    StringBuilder sbSql = new StringBuilder();
    sbSql.append("from MonUserChannelApp m where  1=1 ");
    if (status != null) {
        sbSql.append(" and  m.status=:status ");
    }
    if (StringUtils.isNotBlank(marketName)) {
        sbSql.append(" and   m.marketName=:marketName  ");
    }
    Query query = getSession().createQuery(sbSql.toString());
    if (status != null) {
        query.setBoolean("status", status);
    }
    if (StringUtils.isNotBlank(marketName)) {
        query.setString("marketName", marketName);
    }
    return HibernateHelper.list(query);
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:26,代碼來源:MonUserChannelAppDaoImpl.java

示例4: updateDeleted

import org.hibernate.Query; //導入方法依賴的package包/類
@Override
public Boolean updateDeleted(List<Integer> ids, boolean deleted) {
    String hql = "update Metro set Deleted =:deleted where id in (:ids)";
    Query query = getSession().createQuery(hql);
    query.setBoolean("deleted", deleted);
    query.setParameterList("ids", ids);
    return query.executeUpdate() > 0;
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:9,代碼來源:MetroDaoImpl.java

示例5: setQueryParameterFromCriterion

import org.hibernate.Query; //導入方法依賴的package包/類
public static void setQueryParameterFromCriterion(String propertyName, Query query, CriterionValueType valueType, int pos, CriterionInstantVO value) throws Exception {
	switch (valueType) {
		case BOOLEAN:
			query.setBoolean(pos, value.getBooleanValue());
			break;
		case BOOLEAN_HASH:
			query.setBinary(pos, CryptoUtil.hashForSearch(value.getBooleanValue()));
			break;
		case DATE:
			query.setDate(pos, value.getDateValue());
			break;
		case DATE_HASH:
			query.setBinary(pos, CryptoUtil.hashForSearch(value.getDateValue()));
			break;
		case TIME:
			query.setTime(pos, value.getTimeValue());
			break;
		case TIME_HASH:
			query.setBinary(pos, CryptoUtil.hashForSearch(value.getTimeValue()));
			break;
		case FLOAT:
			query.setFloat(pos, value.getFloatValue().floatValue());
			break;
		case FLOAT_HASH:
			query.setBinary(pos, CryptoUtil.hashForSearch(value.getFloatValue()));
			break;
		case LONG:
			query.setBigInteger(pos, new BigInteger(value.getLongValue().toString()));
			break;
		case LONG_HASH:
			query.setBinary(pos, CryptoUtil.hashForSearch(value.getLongValue()));
			break;
		case STRING:
			query.setString(pos, value.getStringValue());
			break;
		case STRING_HASH:
			query.setBinary(pos, CryptoUtil.hashForSearch(value.getStringValue()));
			break;
		case TIMESTAMP:
			query.setTimestamp(pos, value.getTimestampValue());
			break;
		case TIMESTAMP_HASH:
			query.setBinary(pos, CryptoUtil.hashForSearch(value.getTimestampValue()));
			break;
		case NONE:
			break;
		default:
			// datatype unimplemented
			throw new IllegalArgumentException(MessageFormat.format(CommonUtil.UNSUPPORTED_CRITERION_VALUE_TYPE, valueType.toString()));
	}
}
 
開發者ID:phoenixctms,項目名稱:ctsms,代碼行數:52,代碼來源:QueryUtil.java

示例6: setQueryParameterFromString

import org.hibernate.Query; //導入方法依賴的package包/類
public static void setQueryParameterFromString(Query query, Class propertyClass, int pos, String value) throws Exception {
	if (propertyClass.equals(String.class)) {
		query.setString(pos, value);
	} else if (propertyClass.equals(Long.class)) {
		query.setBigInteger(pos, new BigInteger(value));
	} else if (propertyClass.equals(java.lang.Long.TYPE)) {
		query.setBigInteger(pos, new BigInteger(value));
	} else if (propertyClass.equals(Integer.class)) {
		query.setInteger(pos, new Integer(value));
	} else if (propertyClass.equals(java.lang.Integer.TYPE)) {
		query.setInteger(pos, new Integer(value));
	} else if (propertyClass.equals(Boolean.class)) {
		query.setBoolean(pos, new Boolean(value));
	} else if (propertyClass.equals(java.lang.Boolean.TYPE)) {
		query.setBoolean(pos, new Boolean(value));
	} else if (propertyClass.equals(Float.class)) {
		query.setFloat(pos, new Float(value));
	} else if (propertyClass.equals(java.lang.Float.TYPE)) {
		query.setFloat(pos, new Float(value));
	} else if (propertyClass.equals(Double.class)) {
		query.setDouble(pos, new Double(value));
	} else if (propertyClass.equals(java.lang.Double.TYPE)) {
		query.setDouble(pos, new Double(value));
	} else if (propertyClass.equals(Date.class)) {
		query.setDate(pos, CommonUtil.parseDate(value, CommonUtil.INPUT_DATE_PATTERN));
	} else if (propertyClass.equals(Timestamp.class)) {
		query.setTimestamp(pos, CommonUtil.dateToTimestamp(CommonUtil.parseDate(value, CommonUtil.INPUT_DATETIME_PATTERN)));
	} else if (propertyClass.equals(VariablePeriod.class)) {
		query.setString(pos, VariablePeriod.fromString(value).name());
	} else if (propertyClass.equals(AuthenticationType.class)) {
		query.setString(pos, AuthenticationType.fromString(value).name());
	} else if (propertyClass.equals(Sex.class)) {
		query.setString(pos, Sex.fromString(value).name());
	} else if (propertyClass.equals(DBModule.class)) {
		query.setString(pos, DBModule.fromString(value).name());
	} else if (propertyClass.equals(HyperlinkModule.class)) {
		query.setString(pos, HyperlinkModule.fromString(value).name());
	} else if (propertyClass.equals(JournalModule.class)) {
		query.setString(pos, JournalModule.fromString(value).name());
	} else if (propertyClass.equals(FileModule.class)) {
		query.setString(pos, FileModule.fromString(value).name());
	} else if (propertyClass.equals(Color.class)) {
		query.setString(pos, Color.fromString(value).name());
	} else if (propertyClass.equals(InputFieldType.class)) {
		query.setString(pos, InputFieldType.fromString(value).name());
	} else if (propertyClass.equals(EventImportance.class)) {
		query.setString(pos, EventImportance.fromString(value).name());
	} else if (propertyClass.equals(ExportStatus.class)) {
		query.setString(pos, ExportStatus.fromString(value).name());
	} else if (propertyClass.isArray() && propertyClass.getComponentType().equals(java.lang.Byte.TYPE)) { // only string hashes supported, no boolean, float, etc...
		query.setBinary(pos, CryptoUtil.hashForSearch(value));
	} else {
		// illegal type...
		throw new IllegalArgumentException(MessageFormat.format(CommonUtil.INPUT_TYPE_NOT_SUPPORTED, propertyClass.toString()));
	}
}
 
開發者ID:phoenixctms,項目名稱:ctsms,代碼行數:57,代碼來源:QueryUtil.java


注:本文中的org.hibernate.Query.setBoolean方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。