org.hibernate.type.CompositeType Java Examples

The following examples show how to use org.hibernate.type.CompositeType. 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: IdsClauseBuilder.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
protected String quoteIdentifier(Object... value) {
	if ( value.length == 1 ) {
		return quoteIdentifier( value[0], identifierType );
	}
	else {
		if ( identifierType instanceof CompositeType ) {
			CompositeType compositeType = (CompositeType) identifierType;
			List<String> quotedIdentifiers = new ArrayList<>();

			for ( int i = 0; i < value.length; i++ ) {
				quotedIdentifiers.add(quoteIdentifier( value[i], compositeType.getSubtypes()[i] ));
			}
			return String.join( ",", quotedIdentifiers );
		}
		else {
			throw new IllegalArgumentException("Composite identifier does not implement CompositeType");
		}
	}
}
 
Example #2
Source File: EntityJoinWalker.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private void findKeyManyToOneTargetIndices(
		ArrayList<Integer> keyManyToOneTargetIndices,
		OuterJoinableAssociation joinWithCompositeId,
		CompositeType componentType) {
	for ( Type subType : componentType.getSubtypes() ) {
		if ( subType.isEntityType() ) {
			Integer index = locateKeyManyToOneTargetIndex( joinWithCompositeId, (EntityType) subType );
			if ( index != null ) {
				keyManyToOneTargetIndices.add( index );
			}
		}
		else if ( subType.isComponentType() ) {
			findKeyManyToOneTargetIndices(
					keyManyToOneTargetIndices,
					joinWithCompositeId,
					(CompositeType) subType
			);
		}
	}
}
 
Example #3
Source File: Nullability.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * check sub elements-nullability. Returns property path that break
 * nullability or null if none
 *
 * @param propertyType type to check
 * @param value value to check
 *
 * @return property path
 * @throws HibernateException error while getting subcomponent values
 */
private String checkSubElementsNullability(Type propertyType, Object value) throws HibernateException {
	if ( propertyType.isComponentType() ) {
		return checkComponentNullability( value, (CompositeType) propertyType );
	}

	if ( propertyType.isCollectionType() ) {
		// persistent collections may have components
		final CollectionType collectionType = (CollectionType) propertyType;
		final Type collectionElementType = collectionType.getElementType( session.getFactory() );

		if ( collectionElementType.isComponentType() ) {
			// check for all components values in the collection
			final CompositeType componentType = (CompositeType) collectionElementType;
			final Iterator itr = CascadingActions.getLoadedElementsIterator( session, collectionType, value );
			while ( itr.hasNext() ) {
				final Object compositeElement = itr.next();
				if ( compositeElement != null ) {
					return checkComponentNullability( compositeElement, componentType );
				}
			}
		}
	}

	return null;
}
 
Example #4
Source File: InExpressionIgnoringCase.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException {
	List<TypedValue> list = new ArrayList<>();
	Type type = criteriaQuery.getTypeUsingProjection(criteria, propertyName);
	if (type.isComponentType()) {
		CompositeType actype = (CompositeType) type;
		Type[] types = actype.getSubtypes();
		for (int j = 0; j < values.length; j++) {
			for (int i = 0; i < types.length; i++) {
				Object subval = values[j] == null ? null : actype.getPropertyValues(values[j], EntityMode.POJO)[i];
				list.add(new TypedValue(types[i], subval, EntityMode.POJO));
			}
		}
	} else {
		for (int j = 0; j < values.length; j++) {
			list.add(new TypedValue(type, values[j], EntityMode.POJO));
		}
	}
	return list.toArray(new TypedValue[list.size()]);
}
 
Example #5
Source File: ComponentJoin.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public ComponentJoin(
		FromClause fromClause,
		FromElement origin,
		String alias,
		String componentPath,
		CompositeType componentType) {
	super( fromClause, origin, alias );
	this.componentPath = componentPath;
	this.componentType = componentType;
	this.componentProperty = StringHelper.unqualify( componentPath );
	fromClause.addJoinByPathMap( componentPath, this );
	initializeComponentJoin( new ComponentFromElementType( this ) );

	this.columns = origin.getPropertyMapping( "" ).toColumns( getTableAlias(), componentProperty );
	StringBuilder buf = new StringBuilder();
	for ( int j = 0; j < columns.length; j++ ) {
		final String column = columns[j];
		if ( j > 0 ) {
			buf.append( ", " );
		}
		buf.append( column );
	}
	this.columnsFragment = buf.toString();
}
 
Example #6
Source File: SerializableProxy.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @deprecated use {@link #SerializableProxy(String, Class, Class[], Serializable, Boolean, String, boolean, Method, Method, CompositeType)} instead.
 */
@Deprecated
public SerializableProxy(
		String entityName,
		Class persistentClass,
		Class[] interfaces,
		Serializable id,
		Boolean readOnly,
		Method getIdentifierMethod,
		Method setIdentifierMethod,
		CompositeType componentIdType) {
	this(
			entityName, persistentClass, interfaces, id, readOnly, null, false,
			getIdentifierMethod, setIdentifierMethod, componentIdType
	);
}
 
Example #7
Source File: HibernateTraversableResolver.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private void addAssociationsToTheSetForOneProperty(String name, Type type, String prefix, SessionFactoryImplementor factory) {

		if ( type.isCollectionType() ) {
			CollectionType collType = (CollectionType) type;
			Type assocType = collType.getElementType( factory );
			addAssociationsToTheSetForOneProperty(name, assocType, prefix, factory);
		}
		//ToOne association
		else if ( type.isEntityType() || type.isAnyType() ) {
			associations.add( prefix + name );
		}
		else if ( type.isComponentType() ) {
			CompositeType componentType = (CompositeType) type;
			addAssociationsToTheSetForAllProperties(
					componentType.getPropertyNames(),
					componentType.getSubtypes(),
					(prefix.equals( "" ) ? name : prefix + name) + ".",
					factory);
		}
	}
 
Example #8
Source File: Example.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
protected void addComponentTypedValues(
		String path, 
		Object component, 
		CompositeType type,
		List<TypedValue> list,
		Criteria criteria, 
		CriteriaQuery criteriaQuery) {
	if ( component != null ) {
		final String[] propertyNames = type.getPropertyNames();
		final Type[] subtypes = type.getSubtypes();
		final Object[] values = type.getPropertyValues( component, getEntityMode( criteria, criteriaQuery ) );
		for ( int i=0; i<propertyNames.length; i++ ) {
			final Object value = values[i];
			final Type subtype = subtypes[i];
			final String subpath = StringHelper.qualify( path, propertyNames[i] );
			if ( isPropertyIncluded( value, subpath, subtype ) ) {
				if ( subtype.isComponentType() ) {
					addComponentTypedValues( subpath, value, (CompositeType) subtype, list, criteria, criteriaQuery );
				}
				else {
					addPropertyTypedValue( value, subtype, list );
				}
			}
		}
	}
}
 
Example #9
Source File: QuarkusProxyFactory.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@Override
public void postInstantiate(String entityName, Class persistentClass, Set<Class> interfaces, Method getIdentifierMethod,
        Method setIdentifierMethod, CompositeType componentIdType) throws HibernateException {
    this.entityName = entityName;
    this.persistentClass = persistentClass;
    this.interfaces = toArray(interfaces);
    this.getIdentifierMethod = getIdentifierMethod;
    this.setIdentifierMethod = setIdentifierMethod;
    this.componentIdType = componentIdType;
    ProxyDefinitions.ProxyClassDetailsHolder detailsHolder = proxyClassDefinitions.getProxyForClass(persistentClass);
    if (detailsHolder == null) {
        throw new HibernateException("Could not lookup a pre-generated proxy class definition for entity '" + entityName
                + "'. Falling back to enforced eager mode for this entity!");
    }
    this.overridesEquals = detailsHolder.isOverridesEquals();
    this.constructor = detailsHolder.getConstructor();

}
 
Example #10
Source File: JavassistProxyFactory.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void postInstantiate(
		final String entityName,
		final Class persistentClass,
		final Set<Class> interfaces,
		final Method getIdentifierMethod,
		final Method setIdentifierMethod,
		CompositeType componentIdType) throws HibernateException {
	this.entityName = entityName;
	this.persistentClass = persistentClass;
	this.interfaces = toArray( interfaces );
	this.getIdentifierMethod = getIdentifierMethod;
	this.setIdentifierMethod = setIdentifierMethod;
	this.componentIdType = componentIdType;
	this.overridesEquals = ReflectHelper.overridesEquals( persistentClass );

	this.proxyClass = buildJavassistProxyFactory().createClass();
}
 
Example #11
Source File: ByteBuddyProxyFactory.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void postInstantiate(
		String entityName,
		Class persistentClass,
		Set<Class> interfaces,
		Method getIdentifierMethod,
		Method setIdentifierMethod,
		CompositeType componentIdType) throws HibernateException {
	this.entityName = entityName;
	this.persistentClass = persistentClass;
	this.interfaces = toArray( interfaces );
	this.getIdentifierMethod = getIdentifierMethod;
	this.setIdentifierMethod = setIdentifierMethod;
	this.componentIdType = componentIdType;
	this.overridesEquals = ReflectHelper.overridesEquals( persistentClass );

	this.proxyClass = byteBuddyProxyHelper.buildProxy( persistentClass, this.interfaces );
}
 
Example #12
Source File: AbstractPersistentCollection.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean needsRecreate(CollectionPersister persister) {
	// Workaround for situations like HHH-7072.  If the collection element is a component that consists entirely
	// of nullable properties, we currently have to forcefully recreate the entire collection.  See the use
	// of hasNotNullableColumns in the AbstractCollectionPersister constructor for more info.  In order to delete
	// row-by-row, that would require SQL like "WHERE ( COL = ? OR ( COL is null AND ? is null ) )", rather than
	// the current "WHERE COL = ?" (fails for null for most DBs).  Note that
	// the param would have to be bound twice.  Until we eventually add "parameter bind points" concepts to the
	// AST in ORM 5+, handling this type of condition is either extremely difficult or impossible.  Forcing
	// recreation isn't ideal, but not really any other option in ORM 4.
	// Selecting a type used in where part of update statement
	// (must match condidion in org.hibernate.persister.collection.BasicCollectionPersister.doUpdateRows).
	// See HHH-9474
	Type whereType;
	if ( persister.hasIndex() ) {
		whereType = persister.getIndexType();
	}
	else {
		whereType = persister.getElementType();
	}
	if ( whereType instanceof CompositeType ) {
		CompositeType componentIndexType = (CompositeType) whereType;
		return !componentIndexType.hasNotNullProperty();
	}
	return false;
}
 
Example #13
Source File: CompositionBasedCompositionAttribute.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public CompositionBasedCompositionAttribute(
		AbstractCompositionAttribute source,
		SessionFactoryImplementor sessionFactory,
		int entityBasedAttributeNumber,
		String attributeName,
		CompositeType attributeType,
		int columnStartPosition,
		BaselineAttributeInformation baselineInfo) {
	super(
			source,
			sessionFactory,
			entityBasedAttributeNumber,
			attributeName,
			attributeType,
			columnStartPosition,
			baselineInfo
	);
}
 
Example #14
Source File: AbstractVisitor.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Visit a property value. Dispatch to the
 * correct handler for the property type.
 * @param value
 * @param type
 * @throws HibernateException
 */
final Object processValue(Object value, Type type) throws HibernateException {

	if ( type.isCollectionType() ) {
		//even process null collections
		return processCollection( value, (CollectionType) type );
	}
	else if ( type.isEntityType() ) {
		return processEntity( value, (EntityType) type );
	}
	else if ( type.isComponentType() ) {
		return processComponent( value, (CompositeType) type );
	}
	else {
		return null;
	}
}
 
Example #15
Source File: EntityQuerySpaceImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public ExpandingCompositeQuerySpace makeCompositeIdentifierQuerySpace() {
	final String compositeQuerySpaceUid = getUid() + "-id";
	final ExpandingCompositeQuerySpace rhs = getExpandingQuerySpaces().makeCompositeQuerySpace(
			compositeQuerySpaceUid,
			new CompositePropertyMapping(
					(CompositeType) getEntityPersister().getIdentifierType(),
					(PropertyMapping) getEntityPersister(),
					getEntityPersister().getIdentifierPropertyName()
			),
			canJoinsBeRequired()
	);
	final JoinDefinedByMetadata join = JoinHelper.INSTANCE.createCompositeJoin(
			this,
			EntityPersister.ENTITY_ID,
			rhs,
			canJoinsBeRequired(),
			(CompositeType) persister.getIdentifierType()
	);
	internalGetJoins().add( join );

	return rhs;
}
 
Example #16
Source File: QuerySpaceHelper.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public ExpandingCompositeQuerySpace makeCompositeQuerySpace(
		ExpandingQuerySpace lhsQuerySpace,
		AttributeDefinition attributeDefinition,
		String querySpaceUid,
		boolean shouldIncludeJoin) {
	final boolean required = lhsQuerySpace.canJoinsBeRequired() && !attributeDefinition.isNullable();
	return makeCompositeQuerySpace(
			lhsQuerySpace,
			new CompositePropertyMapping(
					(CompositeType) attributeDefinition.getType(),
					lhsQuerySpace.getPropertyMapping(),
					attributeDefinition.getName()
			),
			attributeDefinition.getName(),
			(CompositeType) attributeDefinition.getType(),
			querySpaceUid,
			required,
			shouldIncludeJoin
	);
}
 
Example #17
Source File: AbstractEntityReference.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Builds just the first level of identifier description.  This will be either a simple id descriptor (String,
 * Long, etc) or some form of composite id (either encapsulated or not).
 *
 * @return the descriptor for the identifier
 */
private EntityIdentifierDescription buildIdentifierDescription() {
	final EntityIdentifierDefinition identifierDefinition = getEntityPersister().getEntityKeyDefinition();

	if ( identifierDefinition.isEncapsulated() ) {
		final EncapsulatedEntityIdentifierDefinition encapsulatedIdentifierDefinition = (EncapsulatedEntityIdentifierDefinition) identifierDefinition;
		final Type idAttributeType = encapsulatedIdentifierDefinition.getAttributeDefinition().getType();
		if ( ! CompositeType.class.isInstance( idAttributeType ) ) {
			return new SimpleEntityIdentifierDescriptionImpl();
		}
	}

	// if we get here, we know we have a composite identifier...
	final ExpandingCompositeQuerySpace querySpace = expandingEntityQuerySpace().makeCompositeIdentifierQuerySpace();
	return identifierDefinition.isEncapsulated()
			? buildEncapsulatedCompositeIdentifierDescription( querySpace )
			: buildNonEncapsulatedCompositeIdentifierDescription( querySpace );
}
 
Example #18
Source File: DefaultRefreshEventListener.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private void evictCachedCollections(Type[] types, Serializable id, EventSource source)
		throws HibernateException {
	for ( Type type : types ) {
		if ( type.isCollectionType() ) {
			CollectionPersister collectionPersister = source.getFactory().getMetamodel().collectionPersister( ( (CollectionType) type ).getRole() );
			if ( collectionPersister.hasCache() ) {
				final CollectionDataAccess cache = collectionPersister.getCacheAccessStrategy();
				final Object ck = cache.generateCacheKey(
					id,
					collectionPersister,
					source.getFactory(),
					source.getTenantIdentifier()
				);
				final SoftLock lock = cache.lockItem( source, ck, null );
				cache.remove( source, ck );
				source.getActionQueue().registerProcess( (success, session) -> cache.unlockItem( session, ck, lock ) );
			}
		}
		else if ( type.isComponentType() ) {
			CompositeType actype = (CompositeType) type;
			evictCachedCollections( actype.getSubtypes(), id, source );
		}
	}
}
 
Example #19
Source File: SerializableProxy.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @deprecated use {@link #SerializableProxy(String, Class, Class[], Serializable, Boolean, String, boolean, Method, Method, CompositeType)} instead.
 */
@Deprecated
public SerializableProxy(
		String entityName,
		Class persistentClass,
		Class[] interfaces,
		Serializable id,
		Boolean readOnly,
		Method getIdentifierMethod,
		Method setIdentifierMethod,
		CompositeType componentIdType) {
	this(
			entityName, persistentClass, interfaces, id, readOnly, null, false,
			getIdentifierMethod, setIdentifierMethod, componentIdType
	);
}
 
Example #20
Source File: WrapVisitor.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
Object processComponent(Object component, CompositeType componentType) throws HibernateException {
	if ( component != null ) {
		Object[] values = componentType.getPropertyValues( component, getSession() );
		Type[] types = componentType.getSubtypes();
		boolean substituteComponent = false;
		for ( int i = 0; i < types.length; i++ ) {
			Object result = processValue( values[i], types[i] );
			if ( result != null ) {
				values[i] = result;
				substituteComponent = true;
			}
		}
		if ( substituteComponent ) {
			componentType.setPropertyValues( component, values, EntityMode.POJO );
		}
	}

	return null;
}
 
Example #21
Source File: AbstractEntityPersister.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private void prepareEntityIdentifierDefinition() {
	if ( entityIdentifierDefinition != null ) {
		return;
	}
	final Type idType = getIdentifierType();

	if ( !idType.isComponentType() ) {
		entityIdentifierDefinition =
				EntityIdentifierDefinitionHelper.buildSimpleEncapsulatedIdentifierDefinition( this );
		return;
	}

	final CompositeType cidType = (CompositeType) idType;
	if ( !cidType.isEmbedded() ) {
		entityIdentifierDefinition =
				EntityIdentifierDefinitionHelper.buildEncapsulatedCompositeIdentifierDefinition( this );
		return;
	}

	entityIdentifierDefinition =
			EntityIdentifierDefinitionHelper.buildNonEncapsulatedCompositeIdentifierDefinition( this );
}
 
Example #22
Source File: AbstractCollectionPersister.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private void initCollectionPropertyMap(String aliasName, Type type, String[] columnAliases, String[] columnNames) {

		collectionPropertyColumnAliases.put( aliasName, columnAliases );
		collectionPropertyColumnNames.put( aliasName, columnNames );

		if ( type.isComponentType() ) {
			CompositeType ct = (CompositeType) type;
			String[] propertyNames = ct.getPropertyNames();
			for ( int i = 0; i < propertyNames.length; i++ ) {
				String name = propertyNames[i];
				collectionPropertyColumnAliases.put( aliasName + "." + name, columnAliases[i] );
				collectionPropertyColumnNames.put( aliasName + "." + name, columnNames[i] );
			}
		}

	}
 
Example #23
Source File: AbstractCompositionAttribute.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected AbstractCompositionAttribute(
		AttributeSource source,
		SessionFactoryImplementor sessionFactory,
		int entityBasedAttributeNumber,
		String attributeName,
		CompositeType attributeType,
		int columnStartPosition,
		BaselineAttributeInformation baselineInfo) {
	super( source, sessionFactory, entityBasedAttributeNumber, attributeName, attributeType, baselineInfo );
	this.columnStartPosition = columnStartPosition;
}
 
Example #24
Source File: AbstractCompositeEntityIdentifierDescription.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected AbstractCompositeEntityIdentifierDescription(
		EntityReference entityReference,
		ExpandingCompositeQuerySpace compositeQuerySpace,
		CompositeType identifierType,
		PropertyPath propertyPath) {
	super( compositeQuerySpace, false, propertyPath );
	this.entityReference = entityReference;
	this.identifierType = identifierType;
}
 
Example #25
Source File: SerializableProxy.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public SerializableProxy(
		String entityName,
		Class persistentClass,
		Class[] interfaces,
		Serializable id,
		Boolean readOnly,
		String sessionFactoryUuid,
		boolean allowLoadOutsideTransaction,
		Method getIdentifierMethod,
		Method setIdentifierMethod,
		CompositeType componentIdType) {
	super( entityName, id, readOnly, sessionFactoryUuid, allowLoadOutsideTransaction );
	this.persistentClass = persistentClass;
	this.interfaces = interfaces;
	if ( getIdentifierMethod != null ) {
		identifierGetterMethodName = getIdentifierMethod.getName();
		identifierGetterMethodClass = getIdentifierMethod.getDeclaringClass();
	}
	else {
		identifierGetterMethodName = null;
		identifierGetterMethodClass = null;
	}

	if ( setIdentifierMethod != null ) {
		identifierSetterMethodName = setIdentifierMethod.getName();
		identifierSetterMethodClass = setIdentifierMethod.getDeclaringClass();
		identifierSetterMethodParams = setIdentifierMethod.getParameterTypes();
	}
	else {
		identifierSetterMethodName = null;
		identifierSetterMethodClass = null;
		identifierSetterMethodParams = null;
	}

	this.componentIdType = componentIdType;
}
 
Example #26
Source File: CompositionSingularSubAttributesHelper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get composite ID sub-attribute definitions.
 *
 * @param entityPersister - the entity persister.
 *
 * @return composite ID sub-attribute definitions.
 */
public static Iterable<AttributeDefinition> getIdentifierSubAttributes(AbstractEntityPersister entityPersister) {
	return getSingularSubAttributes(
			entityPersister,
			entityPersister,
			(CompositeType) entityPersister.getIdentifierType(),
			entityPersister.getTableName(),
			entityPersister.getRootTableIdentifierColumnNames()
	);
}
 
Example #27
Source File: JavassistLazyInitializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public JavassistLazyInitializer(
		String entityName,
		Class persistentClass,
		Class[] interfaces,
		Serializable id,
		Method getIdentifierMethod,
		Method setIdentifierMethod,
		CompositeType componentIdType,
		SharedSessionContractImplementor session,
		boolean overridesEquals) {
	super( entityName, persistentClass, id, getIdentifierMethod, setIdentifierMethod, componentIdType, session, overridesEquals );
	this.interfaces = interfaces;
}
 
Example #28
Source File: SerializableProxy.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public SerializableProxy(
		String entityName,
		Class persistentClass,
		Class[] interfaces,
		Serializable id,
		Boolean readOnly,
		String sessionFactoryUuid,
		boolean allowLoadOutsideTransaction,
		Method getIdentifierMethod,
		Method setIdentifierMethod,
		CompositeType componentIdType) {
	super( entityName, id, readOnly, sessionFactoryUuid, allowLoadOutsideTransaction );
	this.persistentClass = persistentClass;
	this.interfaces = interfaces;
	if ( getIdentifierMethod != null ) {
		identifierGetterMethodName = getIdentifierMethod.getName();
		identifierGetterMethodClass = getIdentifierMethod.getDeclaringClass();
	}
	else {
		identifierGetterMethodName = null;
		identifierGetterMethodClass = null;
	}

	if ( setIdentifierMethod != null ) {
		identifierSetterMethodName = setIdentifierMethod.getName();
		identifierSetterMethodClass = setIdentifierMethod.getDeclaringClass();
		identifierSetterMethodParams = setIdentifierMethod.getParameterTypes();
	}
	else {
		identifierSetterMethodName = null;
		identifierSetterMethodClass = null;
		identifierSetterMethodParams = null;
	}

	this.componentIdType = componentIdType;
}
 
Example #29
Source File: ByteBuddyInterceptor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public ByteBuddyInterceptor(
		String entityName,
		Class persistentClass,
		Class[] interfaces,
		Serializable id,
		Method getIdentifierMethod,
		Method setIdentifierMethod,
		CompositeType componentIdType,
		SharedSessionContractImplementor session,
		boolean overridesEquals) {
	super( entityName, persistentClass, id, getIdentifierMethod, setIdentifierMethod, componentIdType, session, overridesEquals );
	this.interfaces = interfaces;
}
 
Example #30
Source File: Cascade.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private static void cascadeComponent(
		final CascadingAction action,
		final CascadePoint cascadePoint,
		final EventSource eventSource,
		final int componentPathStackDepth,
		final Object parent,
		final Object child,
		final CompositeType componentType,
		final Object anything) {

	Object[] children = null;
	final Type[] types = componentType.getSubtypes();
	final String[] propertyNames = componentType.getPropertyNames();
	for ( int i = 0; i < types.length; i++ ) {
		final CascadeStyle componentPropertyStyle = componentType.getCascadeStyle( i );
		final String subPropertyName = propertyNames[i];
		if ( componentPropertyStyle.doCascade( action ) ) {
			if (children == null) {
				// Get children on demand.
				children = componentType.getPropertyValues( child, eventSource );
			}
			cascadeProperty(
					action,
					cascadePoint,
					eventSource,
					componentPathStackDepth + 1,
					parent,
					children[i],
					types[i],
					componentPropertyStyle,
					subPropertyName,
					anything,
					false
				);
		}
	}
}