/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * Copyright (c) 2012, Red Hat Inc. or third-party contributors as
 * indicated by the @author tags or express copyright attribution
 * statements applied by the authors.  All third-party contributions are
 * distributed under license by Red Hat Inc.
 *
 * This copyrighted material is made available to anyone wishing to use, modify,
 * copy, or redistribute it subject to the terms and conditions of the GNU
 * Lesser General Public License, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this distribution; if not, write to:
 * Free Software Foundation, Inc.
 * 51 Franklin Street, Fifth Floor
 * Boston, MA  02110-1301  USA
 */
package org.hibernate;

import org.hibernate.internal.util.StringHelper;

Thrown when a property cannot be persisted because it is an association with a transient unsaved entity instance.
Author:Gail Badner
/** * Thrown when a property cannot be persisted because it is an association * with a transient unsaved entity instance. * * @author Gail Badner */
public class TransientPropertyValueException extends TransientObjectException { private final String transientEntityName; private final String propertyOwnerEntityName; private final String propertyName;
Constructs an TransientPropertyValueException instance.
Params:
  • message – - the exception message;
  • transientEntityName – - the entity name for the transient entity
  • propertyOwnerEntityName – - the entity name for entity that owns the association property.
  • propertyName – - the property name
/** * Constructs an {@link TransientPropertyValueException} instance. * * @param message - the exception message; * @param transientEntityName - the entity name for the transient entity * @param propertyOwnerEntityName - the entity name for entity that owns * the association property. * @param propertyName - the property name */
public TransientPropertyValueException( String message, String transientEntityName, String propertyOwnerEntityName, String propertyName) { super( message ); this.transientEntityName = transientEntityName; this.propertyOwnerEntityName = propertyOwnerEntityName; this.propertyName = propertyName; }
Returns the entity name for the transient entity.
Returns:the entity name for the transient entity.
/** * Returns the entity name for the transient entity. * @return the entity name for the transient entity. */
public String getTransientEntityName() { return transientEntityName; }
Returns the entity name for entity that owns the association property.
Returns:the entity name for entity that owns the association property
/** * Returns the entity name for entity that owns the association * property. * @return the entity name for entity that owns the association * property */
public String getPropertyOwnerEntityName() { return propertyOwnerEntityName; }
Returns the property name.
Returns:the property name.
/** * Returns the property name. * @return the property name. */
public String getPropertyName() { return propertyName; } @Override public String getMessage() { return super.getMessage() + " : " + StringHelper.qualify( propertyOwnerEntityName, propertyName ) + " -> " + transientEntityName; } }