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


Java StandardBasicTypes類代碼示例

本文整理匯總了Java中org.hibernate.type.StandardBasicTypes的典型用法代碼示例。如果您正苦於以下問題:Java StandardBasicTypes類的具體用法?Java StandardBasicTypes怎麽用?Java StandardBasicTypes使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: createGridTypeConversionMap

import org.hibernate.type.StandardBasicTypes; //導入依賴的package包/類
private static Map<Type, GridType> createGridTypeConversionMap() {
	Map<Type, GridType> conversion = new HashMap<>();
	conversion.put( StandardBasicTypes.CALENDAR, Iso8601StringCalendarType.DATE_TIME );
	conversion.put( StandardBasicTypes.CALENDAR_DATE, Iso8601StringCalendarType.DATE );
	conversion.put( StandardBasicTypes.DATE, Iso8601StringDateType.DATE );
	conversion.put( StandardBasicTypes.TIME, Iso8601StringDateType.TIME );
	conversion.put( StandardBasicTypes.TIMESTAMP, Iso8601StringDateType.DATE_TIME );
	conversion.put( StandardBasicTypes.BYTE, RedisJsonByteType.INSTANCE );
	conversion.put( StandardBasicTypes.INTEGER, RedisHashType.INTEGER );
	conversion.put( StandardBasicTypes.SHORT, RedisHashType.SHORT );
	conversion.put( StandardBasicTypes.LONG, RedisHashType.LONG );
	conversion.put( StandardBasicTypes.DOUBLE, RedisHashType.DOUBLE );
	conversion.put( StandardBasicTypes.FLOAT, RedisHashType.FLOAT );
	conversion.put( StandardBasicTypes.BYTE, RedisHashType.BYTE );
	conversion.put( BinaryType.INSTANCE, RedisJsonBlobType.INSTANCE );
	conversion.put( MaterializedBlobType.INSTANCE, RedisJsonBlobType.INSTANCE );
	conversion.put( StandardBasicTypes.SERIALIZABLE, RedisJsonBlobType.INSTANCE );

	conversion.put( StandardBasicTypes.BOOLEAN, RedisHashType.BOOLEAN );
	conversion.put( StandardBasicTypes.NUMERIC_BOOLEAN, RedisHashType.NUMERIC_BOOLEAN );
	conversion.put( StandardBasicTypes.UUID_BINARY, RedisHashType.UUID_BINARY );
	return conversion;
}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-redis,代碼行數:24,代碼來源:RedisHashTypeConverter.java

示例2: overrideType

import org.hibernate.type.StandardBasicTypes; //導入依賴的package包/類
public GridType overrideType(Type type) {

		if ( type == StandardBasicTypes.BIG_DECIMAL ) {
			return IgniteBigDecimalType.INSTANCE;
		}

		if ( type == StandardBasicTypes.BIG_INTEGER ) {
			return IgniteBigIntegerType.INSTANCE;
		}

		if ( type == StandardBasicTypes.CALENDAR ) {
			return IgniteCalendarType.INSTANCE;
		}

		if ( type == StandardBasicTypes.CALENDAR_DATE ) {
			return IgniteCalendarType.INSTANCE;
		}

		return null;
	}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-ignite,代碼行數:21,代碼來源:IgniteGridTypeMapper.java

示例3: getList

import org.hibernate.type.StandardBasicTypes; //導入依賴的package包/類
@Override
public List<Object[]> getList() {
	//create the session
	Session ses=null;
	//get the session
	ses=HibernateUtil.getSession();
		//create the list of class object
		List<Object[]> list=null;
		//create the named parameterised the query
		SQLQuery query=ses.createSQLQuery("select PRODID,PRODNAME from PRODUCT where price>:price");
		//pass the parameter to query
		query.setString("price", "500");
	//add scalar to query
	query.addScalar("PRODID", StandardBasicTypes.INTEGER);
	query.addScalar("PRODNAME", StandardBasicTypes.STRING);
		//execute the query
		list=query.list();
			//close the session
		HibernateUtil.closeSession(ses);
		//return the list
		return list;
}
 
開發者ID:pratikdimble,項目名稱:Hibernate_Native_SQL_Scalar_Using_DAO_Using_MAVEN,代碼行數:23,代碼來源:DAO_IMPL.java

示例4: InterbaseDialect

import org.hibernate.type.StandardBasicTypes; //導入依賴的package包/類
/**
 * Constructs a InterbaseDialect
 */
public InterbaseDialect() {
	super();
	registerColumnType( Types.BIT, "smallint" );
	registerColumnType( Types.BIGINT, "numeric(18,0)" );
	registerColumnType( Types.SMALLINT, "smallint" );
	registerColumnType( Types.TINYINT, "smallint" );
	registerColumnType( Types.INTEGER, "integer" );
	registerColumnType( Types.CHAR, "char(1)" );
	registerColumnType( Types.VARCHAR, "varchar($l)" );
	registerColumnType( Types.FLOAT, "float" );
	registerColumnType( Types.DOUBLE, "double precision" );
	registerColumnType( Types.DATE, "date" );
	registerColumnType( Types.TIME, "time" );
	registerColumnType( Types.TIMESTAMP, "timestamp" );
	registerColumnType( Types.VARBINARY, "blob" );
	registerColumnType( Types.NUMERIC, "numeric($p,$s)" );
	registerColumnType( Types.BLOB, "blob" );
	registerColumnType( Types.CLOB, "blob sub_type 1" );
	registerColumnType( Types.BOOLEAN, "smallint" );
	
	registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(","||",")" ) );
	registerFunction( "current_date", new NoArgSQLFunction( "current_date", StandardBasicTypes.DATE, false ) );

	getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, NO_BATCH );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:29,代碼來源:InterbaseDialect.java

示例5: getReturnType

import org.hibernate.type.StandardBasicTypes; //導入依賴的package包/類
@Override
public Type getReturnType(Type columnType, Mapping mapping) throws QueryException {
	int[] sqlTypes;
	try {
		sqlTypes = columnType.sqlTypes( mapping );
	}
	catch ( MappingException me ) {
		throw new QueryException( me );
	}

	if ( sqlTypes.length != 1 ) {
		throw new QueryException( "multi-column type in avg()" );
	}

	final int sqlType = sqlTypes[0];
	if ( sqlType == Types.INTEGER || sqlType == Types.BIGINT || sqlType == Types.TINYINT ) {
		return StandardBasicTypes.FLOAT;
	}
	else {
		return columnType;
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:23,代碼來源:ClassicAvgFunction.java

示例6: PostgresPlusDialect

import org.hibernate.type.StandardBasicTypes; //導入依賴的package包/類
/**
 * Constructs a PostgresPlusDialect
 */
public PostgresPlusDialect() {
	super();

	registerFunction( "ltrim", new StandardSQLFunction( "ltrim" ) );
	registerFunction( "rtrim", new StandardSQLFunction( "rtrim" ) );
	registerFunction( "soundex", new StandardSQLFunction( "soundex" ) );
	registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", StandardBasicTypes.DATE, false ) );
	registerFunction( "rowid", new NoArgSQLFunction( "rowid", StandardBasicTypes.LONG, false ) );
	registerFunction( "rownum", new NoArgSQLFunction( "rownum", StandardBasicTypes.LONG, false ) );
	registerFunction( "instr", new StandardSQLFunction( "instr", StandardBasicTypes.INTEGER ) );
	registerFunction( "lpad", new StandardSQLFunction( "lpad", StandardBasicTypes.STRING ) );
	registerFunction( "replace", new StandardSQLFunction( "replace", StandardBasicTypes.STRING ) );
	registerFunction( "rpad", new StandardSQLFunction( "rpad", StandardBasicTypes.STRING ) );
	registerFunction( "translate", new StandardSQLFunction( "translate", StandardBasicTypes.STRING ) );
	registerFunction( "substring", new StandardSQLFunction( "substr", StandardBasicTypes.STRING ) );
	registerFunction( "coalesce", new NvlFunction() );
	registerFunction( "atan2", new StandardSQLFunction( "atan2", StandardBasicTypes.FLOAT ) );
	registerFunction( "mod", new StandardSQLFunction( "mod", StandardBasicTypes.INTEGER ) );
	registerFunction( "nvl", new StandardSQLFunction( "nvl" ) );
	registerFunction( "nvl2", new StandardSQLFunction( "nvl2" ) );
	registerFunction( "power", new StandardSQLFunction( "power", StandardBasicTypes.FLOAT ) );
	registerFunction( "add_months", new StandardSQLFunction( "add_months", StandardBasicTypes.DATE ) );
	registerFunction( "months_between", new StandardSQLFunction( "months_between", StandardBasicTypes.FLOAT ) );
	registerFunction( "next_day", new StandardSQLFunction( "next_day", StandardBasicTypes.DATE ) );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:29,代碼來源:PostgresPlusDialect.java

示例7: SQLServer2005Dialect

import org.hibernate.type.StandardBasicTypes; //導入依賴的package包/類
/**
 * Constructs a SQLServer2005Dialect
 */
public SQLServer2005Dialect() {
	// HHH-3965 fix
	// As per http://www.sql-server-helper.com/faq/sql-server-2005-varchar-max-p01.aspx
	// use varchar(max) and varbinary(max) instead of TEXT and IMAGE types
	registerColumnType( Types.BLOB, "varbinary(MAX)" );
	registerColumnType( Types.VARBINARY, "varbinary(MAX)" );
	registerColumnType( Types.VARBINARY, MAX_LENGTH, "varbinary($l)" );
	registerColumnType( Types.LONGVARBINARY, "varbinary(MAX)" );

	registerColumnType( Types.CLOB, "varchar(MAX)" );
	registerColumnType( Types.LONGVARCHAR, "varchar(MAX)" );
	registerColumnType( Types.VARCHAR, "varchar(MAX)" );
	registerColumnType( Types.VARCHAR, MAX_LENGTH, "varchar($l)" );

	registerColumnType( Types.BIGINT, "bigint" );
	registerColumnType( Types.BIT, "bit" );


	registerFunction( "row_number", new NoArgSQLFunction( "row_number", StandardBasicTypes.INTEGER, true ) );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:24,代碼來源:SQLServer2005Dialect.java

示例8: createGridTypeConversionMap

import org.hibernate.type.StandardBasicTypes; //導入依賴的package包/類
private static Map<Type, AbstractGenericBasicType<?>> createGridTypeConversionMap() {
	Map<Type, AbstractGenericBasicType<? extends Object>> conversion = new HashMap<Type, AbstractGenericBasicType<? extends Object>>();
	conversion.put( StandardBasicTypes.CALENDAR, Iso8601StringCalendarType.DATE_TIME );
	conversion.put( StandardBasicTypes.CALENDAR_DATE, Iso8601StringCalendarType.DATE );
	conversion.put( StandardBasicTypes.DATE, Iso8601StringDateType.DATE );
	conversion.put( StandardBasicTypes.TIME, Iso8601StringDateType.TIME );
	conversion.put( StandardBasicTypes.TIMESTAMP, Iso8601StringDateType.DATE_TIME );
	conversion.put( StandardBasicTypes.BYTE, RedisJsonByteType.INSTANCE );
	conversion.put( StandardBasicTypes.LONG, RedisJsonLongType.INSTANCE );
	conversion.put( BinaryType.INSTANCE, RedisJsonBlobType.INSTANCE );
	conversion.put( MaterializedBlobType.INSTANCE, RedisJsonBlobType.INSTANCE );
	return conversion;
}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-redis,代碼行數:14,代碼來源:RedisJsonTypeConverter.java

示例9: SQLServerDialect

import org.hibernate.type.StandardBasicTypes; //導入依賴的package包/類
public SQLServerDialect()
{
	registerColumnType(Types.NVARCHAR, "nvarchar(MAX)");
	registerColumnType(Types.NVARCHAR, 4000, "nvarchar($l)");
	registerColumnType(Types.LONGNVARCHAR, "nvarchar(MAX)");
	registerColumnType(Types.BIGINT, "numeric(19,0)");
	registerColumnType(Types.BIT, "tinyint");
	registerColumnType(Types.BOOLEAN, "tinyint");

	registerHibernateType(Types.NVARCHAR, StandardBasicTypes.STRING.getName());
	registerHibernateType(Types.NVARCHAR, 4000, StandardBasicTypes.STRING.getName());
	registerHibernateType(Types.LONGNVARCHAR, StandardBasicTypes.STRING.getName());

	StringBuilder sbuf = new StringBuilder();
	try( InputStream inp = getClass().getResourceAsStream("dropconstraints.sql") )
	{
		// Sonar whinges about the new InputStreamReader not being closed in
		// a finally block, but the existing finally block does that ...?
		BufferedReader bufReader = new BufferedReader(new InputStreamReader(inp, "UTF-8")); // NOSONAR
		String line = null;
		while( (line = bufReader.readLine()) != null )
		{
			sbuf.append(line);
			sbuf.append('\n');
		}
		dropConstraintsSQL = sbuf.toString();
	}
	catch( Exception e )
	{
		throw Throwables.propagate(e);
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:33,代碼來源:SQLServerDialect.java

示例10: getMatchingExpressions

import org.hibernate.type.StandardBasicTypes; //導入依賴的package包/類
@Override
@SuppressWarnings("unchecked")
@Transactional(propagation = Propagation.MANDATORY)
public List<Triple<Long, String, Boolean>> getMatchingExpressions(final List<String> values)
{
	return getHibernateTemplate().executeFind(new HibernateCallback()
	{
		@Override
		public Object doInHibernate(Session session)
		{
			// NOTE THAT THIS IS NOT HQL!!! IT IS PRETTY MUCH SQL!!!
			String sql = "SELECT id, expression, dynamic FROM access_expression WHERE id IN"
				+ " (SELECT access_expression_id FROM access_expression_expression_p"
				+ " WHERE element IN (:values))";

			SQLQuery query = session.createSQLQuery(sql);
			query.setParameterList("values", values);
			query.addScalar("id", StandardBasicTypes.LONG);
			query.addScalar("expression", StandardBasicTypes.STRING);
			query.addScalar("dynamic", StandardBasicTypes.BOOLEAN);
			query.setFetchSize(20);

			List<Pair<Long, String>> results = new ArrayList<Pair<Long, String>>();

			List<Object[]> queryResults = query.list();
			for( Object[] o : queryResults )
			{
				results.add(new Triple<Long, String, Boolean>((Long) o[0], (String) o[1], (Boolean) o[2]));
			}
			return results;
		}
	});
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:34,代碼來源:AccessExpressionDaoImpl.java

示例11: resolveHibernateTypeName

import org.hibernate.type.StandardBasicTypes; //導入依賴的package包/類
@Override
public String resolveHibernateTypeName(AnnotationInstance annotationInstance) {
	if ( annotationInstance == null ) {
		return null;
	}
	String type = null;
	if ( Clob.class.isAssignableFrom( mappedAttribute.getAttributeType() ) ) {
		type = StandardBasicTypes.CLOB.getName();
	}
	else if ( Blob.class.isAssignableFrom( mappedAttribute.getAttributeType() ) ) {
		type = StandardBasicTypes.BLOB.getName();
	}
	else if ( String.class.isAssignableFrom( mappedAttribute.getAttributeType() ) ) {
		type = StandardBasicTypes.MATERIALIZED_CLOB.getName();
	}
	else if ( Character[].class.isAssignableFrom( mappedAttribute.getAttributeType() ) ) {
		type = CharacterArrayClobType.class.getName();
	}
	else if ( char[].class.isAssignableFrom( mappedAttribute.getAttributeType() ) ) {
		type = PrimitiveCharacterArrayClobType.class.getName();
	}
	else if ( Byte[].class.isAssignableFrom( mappedAttribute.getAttributeType() ) ) {
		type = WrappedMaterializedBlobType.class.getName();
	}
	else if ( byte[].class.isAssignableFrom( mappedAttribute.getAttributeType() ) ) {
		type = StandardBasicTypes.MATERIALIZED_BLOB.getName();
	}
	else if ( Serializable.class.isAssignableFrom( mappedAttribute.getAttributeType() ) ) {
		type = SerializableToBlobType.class.getName();
	}
	else {
		type = "blob";
	}
	return type;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:36,代碼來源:LobTypeResolver.java

示例12: resolveHibernateTypeName

import org.hibernate.type.StandardBasicTypes; //導入依賴的package包/類
@Override
public String resolveHibernateTypeName(AnnotationInstance temporalAnnotation) {

	if ( isTemporalType( mappedAttribute.getAttributeType() ) ) {
		if ( temporalAnnotation == null ) {
			//SPEC 11.1.47 The Temporal annotation must be specified for persistent fields or properties of type java.util.Date and java.util.Calendar.
			throw new AnnotationException( "Attribute " + mappedAttribute.getName() + " is a Temporal type, but no @Temporal annotation found." );
		}
		TemporalType temporalType = JandexHelper.getEnumValue( temporalAnnotation, "value", TemporalType.class );
		boolean isDate = Date.class.isAssignableFrom( mappedAttribute.getAttributeType() );
		String type;
		switch ( temporalType ) {
			case DATE:
				type = isDate ? StandardBasicTypes.DATE.getName() : StandardBasicTypes.CALENDAR_DATE.getName();
				break;
			case TIME:
				type = StandardBasicTypes.TIME.getName();
				if ( !isDate ) {
					throw new NotYetImplementedException( "Calendar cannot persist TIME only" );
				}
				break;
			case TIMESTAMP:
				type = isDate ? StandardBasicTypes.TIMESTAMP.getName() : StandardBasicTypes.CALENDAR.getName();
				break;
			default:
				throw new AssertionFailure( "Unknown temporal type: " + temporalType );
		}
		return type;
	}
	else {
		if ( temporalAnnotation != null ) {
			throw new AnnotationException(
					"@Temporal should only be set on a java.util.Date or java.util.Calendar property: " + mappedAttribute
							.getName()
			);
		}
	}
	return null;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:40,代碼來源:TemporalTypeResolver.java

示例13: toType

import org.hibernate.type.StandardBasicTypes; //導入依賴的package包/類
public Type toType(String propertyName) throws QueryException {
	if ( propertyName.equals(CollectionPropertyNames.COLLECTION_ELEMENTS) ) {
		return memberPersister.getElementType();
	}
	else if ( propertyName.equals(CollectionPropertyNames.COLLECTION_INDICES) ) {
		if ( !memberPersister.hasIndex() ) throw new QueryException("unindexed collection before indices()");
		return memberPersister.getIndexType();
	}
	else if ( propertyName.equals(CollectionPropertyNames.COLLECTION_SIZE) ) {
		return StandardBasicTypes.INTEGER;
	}
	else if ( propertyName.equals(CollectionPropertyNames.COLLECTION_MAX_INDEX) ) {
		return memberPersister.getIndexType();
	}
	else if ( propertyName.equals(CollectionPropertyNames.COLLECTION_MIN_INDEX) ) {
		return memberPersister.getIndexType();
	}
	else if ( propertyName.equals(CollectionPropertyNames.COLLECTION_MAX_ELEMENT) ) {
		return memberPersister.getElementType();
	}
	else if ( propertyName.equals(CollectionPropertyNames.COLLECTION_MIN_ELEMENT) ) {
		return memberPersister.getElementType();
	}
	else {
		//return memberPersister.getPropertyType(propertyName);
		throw new QueryException("illegal syntax near collection: " + propertyName);
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:29,代碼來源:CollectionPropertyMapping.java

示例14: setParameter

import org.hibernate.type.StandardBasicTypes; //導入依賴的package包/類
public Query setParameter(int position, Object val) throws HibernateException {
	if (val == null) {
		setParameter( position, val, StandardBasicTypes.SERIALIZABLE );
	}
	else {
		setParameter( position, val, determineType( position, val ) );
	}
	return this;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:AbstractQueryImpl.java

示例15: SQLServerDialect

import org.hibernate.type.StandardBasicTypes; //導入依賴的package包/類
public SQLServerDialect(){
    super();
    registerHibernateType(1, "string");     
    registerHibernateType(-9, "string");     
    registerHibernateType(-16, "string");     
    registerHibernateType(3, "double");  
      
    registerHibernateType(Types.CHAR, StandardBasicTypes.STRING.getName());     
    registerHibernateType(Types.NVARCHAR, StandardBasicTypes.STRING.getName());     
    registerHibernateType(Types.LONGNVARCHAR, StandardBasicTypes.STRING.getName());     
    registerHibernateType(Types.DECIMAL, StandardBasicTypes.DOUBLE.getName());
}
 
開發者ID:battlesteed,項目名稱:hibernateMaster,代碼行數:13,代碼來源:SQLServerDialect.java


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