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


Java EntityPersister.setPropertyValues方法代码示例

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


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

示例1: insert

import org.hibernate.persister.entity.EntityPersister; //导入方法依赖的package包/类
@Override
public Serializable insert(String entityName, Object entity) {
	errorIfClosed();
	EntityPersister persister = getEntityPersister( entityName, entity );
	Serializable id = persister.getIdentifierGenerator().generate( this, entity );
	Object[] state = persister.getPropertyValues( entity );
	if ( persister.isVersioned() ) {
		boolean substitute = Versioning.seedVersion(
				state, persister.getVersionProperty(), persister.getVersionType(), this
		);
		if ( substitute ) {
			persister.setPropertyValues( entity, state );
		}
	}
	if ( id == IdentifierGeneratorHelper.POST_INSERT_INDICATOR ) {
		id = persister.insert(state, entity, this);
	}
	else {
		persister.insert(id, state, entity, this);
	}
	persister.setIdentifier( entity, id, this );
	return id;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:StatelessSessionImpl.java

示例2: update

import org.hibernate.persister.entity.EntityPersister; //导入方法依赖的package包/类
@Override
public void update(String entityName, Object entity) {
	errorIfClosed();
	EntityPersister persister = getEntityPersister(entityName, entity);
	Serializable id = persister.getIdentifier( entity, this );
	Object[] state = persister.getPropertyValues( entity );
	Object oldVersion;
	if ( persister.isVersioned() ) {
		oldVersion = persister.getVersion( entity );
		Object newVersion = Versioning.increment( oldVersion, persister.getVersionType(), this );
		Versioning.setVersion(state, newVersion, persister);
		persister.setPropertyValues( entity, state );
	}
	else {
		oldVersion = null;
	}
	persister.update(id, state, null, false, null, oldVersion, entity, null, this);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:StatelessSessionImpl.java

示例3: copyValues

import org.hibernate.persister.entity.EntityPersister; //导入方法依赖的package包/类
protected void copyValues(
		final EntityPersister persister,
		final Object entity,
		final Object target,
		final SessionImplementor source,
		final Map copyCache) {
	final Object[] copiedValues = TypeHelper.replace(
			persister.getPropertyValues( entity ),
			persister.getPropertyValues( target ),
			persister.getPropertyTypes(),
			source,
			target,
			copyCache
	);

	persister.setPropertyValues( target, copiedValues );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:DefaultMergeEventListener.java

示例4: assemble

import org.hibernate.persister.entity.EntityPersister; //导入方法依赖的package包/类
/**
 * Assemble the previously disassembled state represented by this entry into the given entity instance.
 *
 * Additionally manages the PreLoadEvent callbacks.
 *
 * @param instance The entity instance
 * @param id The entity identifier
 * @param persister The entity persister
 * @param interceptor (currently unused)
 * @param session The session
 *
 * @return The assembled state
 *
 * @throws HibernateException Indicates a problem performing assembly or calling the PreLoadEventListeners.
 *
 * @see org.hibernate.type.Type#assemble
 * @see org.hibernate.type.Type#disassemble
 */
public Object[] assemble(
		final Object instance,
		final Serializable id,
		final EntityPersister persister,
		final Interceptor interceptor,
		final EventSource session) throws HibernateException {
	if ( !persister.getEntityName().equals( subclass ) ) {
		throw new AssertionFailure( "Tried to assemble a different subclass instance" );
	}

	//assembled state gets put in a new array (we read from cache by value!)
	final Object[] assembledProps = TypeHelper.assemble(
			disassembledState,
			persister.getPropertyTypes(),
			session, instance
	);

	//persister.setIdentifier(instance, id); //before calling interceptor, for consistency with normal load

	//TODO: reuse the PreLoadEvent
	final PreLoadEvent preLoadEvent = new PreLoadEvent( session )
			.setEntity( instance )
			.setState( assembledProps )
			.setId( id )
			.setPersister( persister );

	final EventListenerGroup<PreLoadEventListener> listenerGroup = session
			.getFactory()
			.getServiceRegistry()
			.getService( EventListenerRegistry.class )
			.getEventListenerGroup( EventType.PRE_LOAD );
	for ( PreLoadEventListener listener : listenerGroup.listeners() ) {
		listener.onPreLoad( preLoadEvent );
	}

	persister.setPropertyValues( instance, assembledProps );

	return assembledProps;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:58,代码来源:StandardCacheEntryImpl.java

示例5: process

import org.hibernate.persister.entity.EntityPersister; //导入方法依赖的package包/类
@Override
void process(Object object, EntityPersister persister) throws HibernateException {
	final Object[] values = persister.getPropertyValues( object );
	final Type[] types = persister.getPropertyTypes();
	processEntityPropertyValues( values, types );
	if ( isSubstitutionRequired() ) {
		persister.setPropertyValues( object, values );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:WrapVisitor.java

示例6: onFlushEntity

import org.hibernate.persister.entity.EntityPersister; //导入方法依赖的package包/类
/**
 * Flushes a single entity's state to the database, by scheduling
 * an update action, if necessary
 */
public void onFlushEntity(FlushEntityEvent event) throws HibernateException {
	final Object entity = event.getEntity();
	final EntityEntry entry = event.getEntityEntry();
	final EventSource session = event.getSession();
	final EntityPersister persister = entry.getPersister();
	final Status status = entry.getStatus();
	final Type[] types = persister.getPropertyTypes();

	final boolean mightBeDirty = entry.requiresDirtyCheck( entity );

	final Object[] values = getValues( entity, entry, mightBeDirty, session );

	event.setPropertyValues( values );

	//TODO: avoid this for non-new instances where mightBeDirty==false
	boolean substitute = wrapCollections( session, persister, types, values );

	if ( isUpdateNecessary( event, mightBeDirty ) ) {
		substitute = scheduleUpdate( event ) || substitute;
	}

	if ( status != Status.DELETED ) {
		// now update the object .. has to be outside the main if block above (because of collections)
		if ( substitute ) {
			persister.setPropertyValues( entity, values );
		}

		// Search for collections by reachability, updating their role.
		// We don't want to touch collections reachable from a deleted object
		if ( persister.hasCollections() ) {
			new FlushVisitor( session, entity ).processEntityPropertyValues( values, types );
		}
	}

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:40,代码来源:DefaultFlushEntityEventListener.java


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