HHH-15652 roll back addition of remove(entityName, instance)

I messed up and forgot we don't want people passing detached
instances to remove().

reverts 4274cb4313
This commit is contained in:
Gavin King 2022-11-09 12:37:50 +01:00
parent 6f85a56cad
commit f71cf01620
4 changed files with 1 additions and 37 deletions

View File

@ -652,7 +652,7 @@ public interface Session extends SharedSessionContract, EntityManager {
* @param entityName the entity name for the instance to be removed.
* @param object the instance to be removed
*
* @deprecated use {@link #remove(String, Object)}
* @deprecated use {@link #remove(Object)}
*/
@Deprecated(since = "6.0")
void delete(String entityName, Object object);
@ -824,16 +824,6 @@ public interface Session extends SharedSessionContract, EntityManager {
@Override
void remove(Object object);
/**
* Mark a persistence instance associated with this session for removal from
* the underlying database. Ths operation cascades to associated instances if
* the association is mapped {@link jakarta.persistence.CascadeType#REMOVE}.
*
* @param entityName the name of the entity
* @param object the managed persistent instance to remove
*/
void remove(String entityName, Object object);
/**
* Determine the current {@link LockMode} of the given managed instance associated
* with this session.

View File

@ -821,11 +821,6 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
delegate.remove( entity );
}
@Override
public void remove(String entityName, Object object) {
delegate.remove( entityName, object );
}
@Override
public <T> T find(Class<T> entityClass, Object primaryKey) {
return delegate.find( entityClass, primaryKey );

View File

@ -328,11 +328,6 @@ public class SessionLazyDelegator implements Session {
this.lazySession.get().remove( object );
}
@Override
public void remove(String entityName, Object object) {
this.lazySession.get().remove( entityName, object );
}
@Override
public LockMode getCurrentLockMode(Object object) {
return this.lazySession.get().getCurrentLockMode( object );

View File

@ -2272,22 +2272,6 @@ public class SessionImpl
}
}
@Override
public void remove(String entityName, Object entity) {
checkOpen();
try {
delete( entityName, entity );
}
catch (MappingException e) {
throw getExceptionConverter().convert( new IllegalArgumentException( e.getMessage(), e ) );
}
catch ( RuntimeException e ) {
//including HibernateException
throw getExceptionConverter().convert( e );
}
}
@Override
public <T> T find(Class<T> entityClass, Object primaryKey) {
return find( entityClass, primaryKey, null, null );