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


Java Query.setFloat方法代码示例

本文整理汇总了Java中org.hibernate.Query.setFloat方法的典型用法代码示例。如果您正苦于以下问题:Java Query.setFloat方法的具体用法?Java Query.setFloat怎么用?Java Query.setFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hibernate.Query的用法示例。


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

示例1: 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

示例2: 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.setFloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。