All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.PropertyValueException Maven / Gradle / Ivy

The newest version!
/*
 * SPDX-License-Identifier: LGPL-2.1-or-later
 * Copyright Red Hat Inc. and Hibernate Authors
 */
package org.hibernate;

import static org.hibernate.internal.util.StringHelper.qualify;

/**
 * Thrown when the (illegal) value of a property can not be persisted.
 * There are two main causes:
 * 
    *
  • a property declared * {@link jakarta.persistence.Basic#optional() @Basic(optional=false)} * is null, or *
  • an association references an unsaved transient instance. *
* * @author Gavin King */ public class PropertyValueException extends HibernateException { private final String entityName; private final String propertyName; /** * Constructs a {@code PropertyValueException} using the specified information. * * @param message A message explaining the exception condition * @param entityName The name of the entity, containing the property * @param propertyName The name of the property being accessed. */ public PropertyValueException(String message, String entityName, String propertyName) { super( message ); this.entityName = entityName; this.propertyName = propertyName; } public String getEntityName() { return entityName; } public String getPropertyName() { return propertyName; } @Override public String getMessage() { return super.getMessage() + ": " + qualify( entityName, propertyName ); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy