org.hibernate.StaleObjectStateException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of beangle-hibernate-core Show documentation
Show all versions of beangle-hibernate-core Show documentation
Hibernate Orm Core Shade,Support Scala Collection
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate;
import static org.hibernate.pretty.MessageHelper.infoString;
/**
* A specialized {@link StaleStateException} that carries information about
* the particular entity instance that was the source of the failure.
*
* @author Gavin King
*/
public class StaleObjectStateException extends StaleStateException {
private final String entityName;
private final Object identifier;
/**
* Constructs a {@code StaleObjectStateException} using the supplied information.
* @param entityName The name of the entity
* @param identifier The identifier of the entity
*/
public StaleObjectStateException(String entityName, Object identifier) {
super( "Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)" );
this.entityName = entityName;
this.identifier = identifier;
}
public String getEntityName() {
return entityName;
}
public Object getIdentifier() {
return identifier;
}
public String getMessage() {
return super.getMessage() + ": " + infoString( entityName, identifier );
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy