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


Java EntityPersister.getVersionProperty方法代码示例

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


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

示例1: getTypedValues

import org.hibernate.persister.entity.EntityPersister; //导入方法依赖的package包/类
@Override
public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) {
	final EntityPersister meta = criteriaQuery.getFactory().getEntityPersister(
			criteriaQuery.getEntityName( criteria )
	);
	final String[] propertyNames = meta.getPropertyNames();
	final Type[] propertyTypes = meta.getPropertyTypes();

	final Object[] values = meta.getPropertyValues( exampleEntity );
	final List<TypedValue> list = new ArrayList<TypedValue>();
	for ( int i=0; i<propertyNames.length; i++ ) {
		final Object value = values[i];
		final Type type = propertyTypes[i];
		final String name = propertyNames[i];

		final boolean isVersionProperty = i == meta.getVersionProperty();

		if ( ! isVersionProperty && isPropertyIncluded( value, name, type ) ) {
			if ( propertyTypes[i].isComponentType() ) {
				addComponentTypedValues( name, value, (CompositeType) type, list, criteria, criteriaQuery );
			}
			else {
				addPropertyTypedValue( value, type, list );
			}
		}
	}

	return list.toArray( new TypedValue[ list.size() ] );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:Example.java

示例2: toSqlString

import org.hibernate.persister.entity.EntityPersister; //导入方法依赖的package包/类
@Override
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) {
	final StringBuilder buf = new StringBuilder().append( '(' );
	final EntityPersister meta = criteriaQuery.getFactory().getEntityPersister(
			criteriaQuery.getEntityName( criteria )
	);
	final String[] propertyNames = meta.getPropertyNames();
	final Type[] propertyTypes = meta.getPropertyTypes();

	final Object[] propertyValues = meta.getPropertyValues( exampleEntity );
	for ( int i=0; i<propertyNames.length; i++ ) {
		final Object propertyValue = propertyValues[i];
		final String propertyName = propertyNames[i];

		final boolean isVersionProperty = i == meta.getVersionProperty();
		if ( ! isVersionProperty && isPropertyIncluded( propertyValue, propertyName, propertyTypes[i] ) ) {
			if ( propertyTypes[i].isComponentType() ) {
				appendComponentCondition(
					propertyName,
					propertyValue,
					(CompositeType) propertyTypes[i],
					criteria,
					criteriaQuery,
					buf
				);
			}
			else {
				appendPropertyCondition(
					propertyName,
					propertyValue,
					criteria,
					criteriaQuery,
					buf
				);
			}
		}
	}

	if ( buf.length()==1 ) {
		buf.append( "1=1" );
	}

	return buf.append( ')' ).toString();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:45,代码来源:Example.java

示例3: setVersion

import org.hibernate.persister.entity.EntityPersister; //导入方法依赖的package包/类
/**
 * Inject the optimistic locking value into the entity state snapshot.
 *
 * @param fields The state snapshot
 * @param version The optimistic locking value
 * @param persister The entity persister
 */
public static void setVersion(Object[] fields, Object version, EntityPersister persister) {
	if ( !persister.isVersioned() ) {
		return;
	}
	fields[ persister.getVersionProperty() ] = version;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:Versioning.java

示例4: getVersion

import org.hibernate.persister.entity.EntityPersister; //导入方法依赖的package包/类
/**
 * Extract the optimistic locking value out of the entity state snapshot.
 *
 * @param fields The state snapshot
 * @param persister The entity persister
 * @return The extracted optimistic locking value
 */
public static Object getVersion(Object[] fields, EntityPersister persister) {
	if ( !persister.isVersioned() ) {
		return null;
	}
	return fields[ persister.getVersionProperty() ];
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:Versioning.java


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