/** * Nullifies any references to transient entities in the entity state * maintained by this action. References to transient entities * should be nullified when an entity is made "managed" or when this * action is executed, whichever is first. * <p/> * References will only be nullified the first time this method is * called for a this object, so it can safely be called both when * the entity is made "managed" and when this action is executed. * * @see {@link #makeEntityManaged() } */ protected final void nullifyTransientReferencesIfNotAlready() { if ( ! areTransientReferencesNullified ) { new ForeignKeys.Nullifier( getInstance(), false, isEarlyInsert(), getSession() ) .nullifyTransientReferences( getState(), getPersister().getPropertyTypes() ); new Nullability( getSession() ).checkNullability( getState(), getPersister(), false ); areTransientReferencesNullified = true; } }
final String breakProperties = checkSubElementsNullability( propertyTypes[i], subValue ); if ( breakProperties != null ) { return buildPropertyPath( compositeType.getPropertyNames()[i], breakProperties );
return checkComponentNullability( value, (CompositeType) propertyType ); final Object compositeElement = itr.next(); if ( compositeElement != null ) { return checkComponentNullability( compositeElement, componentType );
/** * Check nullability of the class persister properties * * @param values entity properties * @param persister class persister * @param isUpdate whether it is intended to be updated or saved * * @throws PropertyValueException Break the nullability of one property * @throws HibernateException error while getting Component values */ public void checkNullability( final Object[] values, final EntityPersister persister, final boolean isUpdate) { checkNullability( values, persister, isUpdate ? NullabilityCheckType.UPDATE : NullabilityCheckType.CREATE ); }
checkSubElementsNullability( contributor, value, checkType, collector );
if ( navigable instanceof EmbeddedValuedNavigable ) { final EmbeddedTypeDescriptor embeddedDescriptor = ( (EmbeddedValuedNavigable) navigable ).getEmbeddedDescriptor(); checkNullabilityInternal( embeddedDescriptor.getPropertyValues( value ), embeddedDescriptor, final EmbeddedTypeDescriptor embeddedDescriptor = ( (CollectionElementEmbedded) elementDescriptor ) .getEmbeddedDescriptor(); checkNullabilityInternal( embeddedDescriptor.getPropertyValues( value ), embeddedDescriptor,
/** * Check nullability of the class entityDescriptor properties * * @param values entity properties * @param entityDescriptor class entity descriptor * @param isUpdate whether it is intended to be updated or saved * * @throws PropertyValueException Break the nullability of one property * @throws HibernateException error while getting Component values */ public void checkNullability( final Object[] values, final EntityTypeDescriptor entityDescriptor, final boolean isUpdate) { checkNullability( values, entityDescriptor, isUpdate ? NullabilityCheckType.UPDATE : NullabilityCheckType.CREATE ); }
public void checkNullability( final Object[] values, final EntityTypeDescriptor entityDescriptor, final NullabilityCheckType checkType) { /* * Typically when Bean Validation is on, we don't want to validate null values * at the Hibernate Core level. Hence the checkNullability setting. */ if ( !checkNullability ) { return; } final PathCollector collector = new PathCollector(); checkNullabilityInternal( values, entityDescriptor, checkType, collector ); if ( collector.hasAny() ) { throw new PropertyValueException( "not-null property references a null or transient value", entityDescriptor.getEntityName(), collector.collectedString() ); } }
new Nullability( session ).checkNullability( entityEntry.getDeletedState(), persister, Nullability.NullabilityCheckType.DELETE ); persistenceContext.getNullifiableEntityKeys().add( key );
public enum NullabilityCheckType { CREATE, UPDATE, DELETE }
return checkComponentNullability( value, (CompositeType) propertyType ); Object compValue = iter.next(); if (compValue != null) { return checkComponentNullability(compValue, componentType);
new Nullability( session ).checkNullability( values, persister, true );
String breakProperties = checkSubElementsNullability( propertyTypes[i], subvalue ); if ( breakProperties != null ) { return buildPropertyPath( compType.getPropertyNames()[i], breakProperties );
return checkComponentNullability( value, (CompositeType) propertyType ); Object compValue = iter.next(); if (compValue != null) { return checkComponentNullability(compValue, componentType);
/** * Nullifies any references to transient entities in the entity state * maintained by this action. References to transient entities * should be nullified when an entity is made "managed" or when this * action is executed, whichever is first. * <p/> * References will only be nullified the first time this method is * called for a this object, so it can safely be called both when * the entity is made "managed" and when this action is executed. * * @see {@link #makeEntityManaged() } */ protected final void nullifyTransientReferencesIfNotAlready() { if ( ! areTransientReferencesNullified ) { new ForeignKeys.Nullifier( getInstance(), false, isEarlyInsert(), getSession() ) .nullifyTransientReferences( getState(), getPersister().getPropertyTypes() ); new Nullability( getSession() ).checkNullability( getState(), getPersister(), false ); areTransientReferencesNullified = true; } }
String breakProperties = checkSubElementsNullability( propertyTypes[i], subvalue ); if ( breakProperties != null ) { return buildPropertyPath( compType.getPropertyNames()[i], breakProperties );
/** * Nullifies any references to transient entities in the entity state * maintained by this action. References to transient entities * should be nullified when an entity is made "managed" or when this * action is executed, whichever is first. * <p/> * References will only be nullified the first time this method is * called for a this object, so it can safely be called both when * the entity is made "managed" and when this action is executed. * * @see #makeEntityManaged() */ @SuppressWarnings("unchecked") protected final void nullifyTransientReferencesIfNotAlready() { if ( ! areTransientReferencesNullified ) { final List<NonIdPersistentAttribute<?,?>> persistentAttributes = ( (EntityTypeDescriptor) getEntityDescriptor() ).getPersistentAttributes(); final Object[] state = getState(); new ForeignKeys.Nullifier( getInstance(), false, isEarlyInsert(), getSession() ) .nullifyTransientReferences( state, persistentAttributes ); new Nullability( getSession() ).checkNullability( state, getEntityDescriptor(), false ); areTransientReferencesNullified = true; } }
String breakProperties = checkSubElementsNullability( propertyTypes[i], value ); if ( breakProperties != null ) { throw new PropertyValueException( "not-null property references a null or transient value", persister.getEntityName(), buildPropertyPath( persister.getPropertyNames()[i], breakProperties ) );
/** * Nullifies any references to transient entities in the entity state * maintained by this action. References to transient entities * should be nullified when an entity is made "managed" or when this * action is executed, whichever is first. * <p/> * References will only be nullified the first time this method is * called for a this object, so it can safely be called both when * the entity is made "managed" and when this action is executed. * * @see {@link #makeEntityManaged() } */ protected final void nullifyTransientReferencesIfNotAlready() { if ( ! areTransientReferencesNullified ) { new ForeignKeys.Nullifier( getInstance(), false, isEarlyInsert(), getSession() ) .nullifyTransientReferences( getState(), getPersister().getPropertyTypes() ); new Nullability( getSession() ).checkNullability( getState(), getPersister(), false ); areTransientReferencesNullified = true; } }
String breakProperties = checkSubElementsNullability( propertyTypes[i], value ); if ( breakProperties != null ) { throw new PropertyValueException( "not-null property references a null or transient value", persister.getEntityName(), buildPropertyPath( persister.getPropertyNames()[i], breakProperties ) );