當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。