Java Code Examples for org.hibernate.type.TypeHelper#replace()

The following examples show how to use org.hibernate.type.TypeHelper#replace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultReactiveMergeEventListener.java    From hibernate-reactive with GNU Lesser General Public License v2.1 6 votes vote down vote up
protected void copyValues(
		final EntityPersister persister,
		final Object entity,
		final Object target,
		final SessionImplementor source,
		final MergeContext copyCache) {
	final Object[] copiedValues = TypeHelper.replace(
			persister.getPropertyValues( entity ),
			persister.getPropertyValues( target ),
			persister.getPropertyTypes(),
			source,
			target,
			copyCache
	);

	persister.setPropertyValues( target, copiedValues );
}
 
Example 2
Source File: DefaultMergeEventListener.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
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 );
}
 
Example 3
Source File: DefaultReactiveMergeEventListener.java    From hibernate-reactive with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void copyValues(
		final EntityPersister persister,
		final Object entity,
		final Object target,
		final SessionImplementor source,
		final MergeContext copyCache,
		final ForeignKeyDirection foreignKeyDirection) {

	final Object[] copiedValues;

	if ( foreignKeyDirection == ForeignKeyDirection.TO_PARENT ) {
		// this is the second pass through on a merge op, so here we limit the
		// replacement to associations types (value types were already replaced
		// during the first pass)
		copiedValues = TypeHelper.replaceAssociations(
				persister.getPropertyValues( entity ),
				persister.getPropertyValues( target ),
				persister.getPropertyTypes(),
				source,
				target,
				copyCache,
				foreignKeyDirection
		);
	}
	else {
		copiedValues = TypeHelper.replace(
				persister.getPropertyValues( entity ),
				persister.getPropertyValues( target ),
				persister.getPropertyTypes(),
				source,
				target,
				copyCache,
				foreignKeyDirection
		);
	}

	persister.setPropertyValues( target, copiedValues );
}
 
Example 4
Source File: DefaultMergeEventListener.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected void copyValues(
		final EntityPersister persister,
		final Object entity,
		final Object target,
		final SessionImplementor source,
		final Map copyCache,
		final ForeignKeyDirection foreignKeyDirection) {

	final Object[] copiedValues;

	if ( foreignKeyDirection == ForeignKeyDirection.TO_PARENT ) {
		// this is the second pass through on a merge op, so here we limit the
		// replacement to associations types (value types were already replaced
		// during the first pass)
		copiedValues = TypeHelper.replaceAssociations(
				persister.getPropertyValues( entity ),
				persister.getPropertyValues( target ),
				persister.getPropertyTypes(),
				source,
				target,
				copyCache,
				foreignKeyDirection
		);
	}
	else {
		copiedValues = TypeHelper.replace(
				persister.getPropertyValues( entity ),
				persister.getPropertyValues( target ),
				persister.getPropertyTypes(),
				source,
				target,
				copyCache,
				foreignKeyDirection
		);
	}

	persister.setPropertyValues( target, copiedValues );
}