type ids as Object instead of Serializable

This commit is contained in:
Gavin King 2021-03-01 18:26:42 +01:00
parent abfa2de1d4
commit d4aa643630
44 changed files with 106 additions and 135 deletions

View File

@ -44,7 +44,7 @@ public interface Cache extends javax.persistence.Cache {
* @return True if the underlying cache contains corresponding data; false
* otherwise.
*/
boolean containsEntity(Class entityClass, Serializable identifier);
boolean containsEntity(Class entityClass, Object identifier);
/**
* Determine whether the cache contains data for the given entity "instance".
@ -57,7 +57,7 @@ public interface Cache extends javax.persistence.Cache {
*
* @return True if the underlying cache contains corresponding data; false otherwise.
*/
boolean containsEntity(String entityName, Serializable identifier);
boolean containsEntity(String entityName, Object identifier);
/**
* Evicts the entity data for a particular entity "instance".
@ -67,7 +67,7 @@ public interface Cache extends javax.persistence.Cache {
*
* @since 5.3
*/
void evictEntityData(Class entityClass, Serializable identifier);
void evictEntityData(Class entityClass, Object identifier);
/**
* Evicts the entity data for a particular entity "instance".
@ -77,7 +77,7 @@ public interface Cache extends javax.persistence.Cache {
*
* @since 5.3
*/
void evictEntityData(String entityName, Serializable identifier);
void evictEntityData(String entityName, Object identifier);
/**
* Evicts all entity data from the given region (i.e. for all entities of
@ -156,7 +156,7 @@ public interface Cache extends javax.persistence.Cache {
* @return True if the underlying cache contains corresponding data; false otherwise.
*/
@SuppressWarnings( {"UnusedDeclaration"})
boolean containsCollection(String role, Serializable ownerIdentifier);
boolean containsCollection(String role, Object ownerIdentifier);
/**
@ -167,7 +167,7 @@ public interface Cache extends javax.persistence.Cache {
*
* @since 5.3
*/
void evictCollectionData(String role, Serializable ownerIdentifier);
void evictCollectionData(String role, Object ownerIdentifier);
/**
* Evicts cached data for the given collection role
@ -271,7 +271,7 @@ public interface Cache extends javax.persistence.Cache {
* @deprecated Use {@link Cache#evictEntityData(Class, Serializable)} instead
*/
@Deprecated
default void evictEntity(Class entityClass, Serializable identifier) {
default void evictEntity(Class entityClass, Object identifier) {
evictEntityData( entityClass, identifier );
}
@ -284,7 +284,7 @@ public interface Cache extends javax.persistence.Cache {
* @deprecated Use {@link Cache#evictEntityData(String, Serializable)} instead
*/
@Deprecated
default void evictEntity(String entityName, Serializable identifier) {
default void evictEntity(String entityName, Object identifier) {
evictEntityData( entityName, identifier );
}

View File

@ -6,7 +6,6 @@
*/
package org.hibernate;
import java.io.Serializable;
import java.util.Optional;
/**
@ -74,5 +73,5 @@ public interface SimpleNaturalIdLoadAccess<T> {
*
* @return The persistent instance, if one, wrapped in Optional
*/
Optional<T> loadOptional(Serializable naturalIdValue);
Optional<T> loadOptional(Object naturalIdValue);
}

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.cache.internal;
import java.io.Serializable;
import java.util.Collections;
import java.util.Set;
@ -53,23 +52,23 @@ public class DisabledCaching implements CacheImplementor {
}
@Override
public boolean containsEntity(Class entityClass, Serializable identifier) {
public boolean containsEntity(Class entityClass, Object identifier) {
return false;
}
@Override
public boolean containsEntity(String entityName, Serializable identifier) {
public boolean containsEntity(String entityName, Object identifier) {
return false;
}
@Override
public void evictEntityData(Class entityClass, Serializable identifier) {
public void evictEntityData(Class entityClass, Object identifier) {
// nothing to do
}
@Override
public void evictEntityData(String entityName, Serializable identifier) {
public void evictEntityData(String entityName, Object identifier) {
// nothing to do
}
@ -105,12 +104,12 @@ public class DisabledCaching implements CacheImplementor {
}
@Override
public boolean containsCollection(String role, Serializable ownerIdentifier) {
public boolean containsCollection(String role, Object ownerIdentifier) {
return false;
}
@Override
public void evictCollectionData(String role, Serializable ownerIdentifier) {
public void evictCollectionData(String role, Object ownerIdentifier) {
// nothing to do
}

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.cache.internal;
import java.io.Serializable;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
@ -220,12 +219,12 @@ public class EnabledCaching implements CacheImplementor, DomainDataRegionBuildin
// Entity data
@Override
public boolean containsEntity(Class entityClass, Serializable identifier) {
public boolean containsEntity(Class entityClass, Object identifier) {
return containsEntity( entityClass.getName(), identifier );
}
@Override
public boolean containsEntity(String entityName, Serializable identifier) {
public boolean containsEntity(String entityName, Object identifier) {
final EntityPersister entityDescriptor = sessionFactory.getMetamodel().entityPersister( entityName );
final EntityDataAccess cacheAccess = entityDescriptor.getCacheAccessStrategy();
if ( cacheAccess == null ) {
@ -237,12 +236,12 @@ public class EnabledCaching implements CacheImplementor, DomainDataRegionBuildin
}
@Override
public void evictEntityData(Class entityClass, Serializable identifier) {
public void evictEntityData(Class entityClass, Object identifier) {
evictEntityData( entityClass.getName(), identifier );
}
@Override
public void evictEntityData(String entityName, Serializable identifier) {
public void evictEntityData(String entityName, Object identifier) {
final EntityPersister entityDescriptor = sessionFactory.getMetamodel().entityPersister( entityName );
final EntityDataAccess cacheAccess = entityDescriptor.getCacheAccessStrategy();
if ( cacheAccess == null ) {
@ -344,7 +343,7 @@ public class EnabledCaching implements CacheImplementor, DomainDataRegionBuildin
// Collection data
@Override
public boolean containsCollection(String role, Serializable ownerIdentifier) {
public boolean containsCollection(String role, Object ownerIdentifier) {
final CollectionPersister collectionDescriptor = sessionFactory.getMetamodel()
.collectionPersister( role );
@ -358,7 +357,7 @@ public class EnabledCaching implements CacheImplementor, DomainDataRegionBuildin
}
@Override
public void evictCollectionData(String role, Serializable ownerIdentifier) {
public void evictCollectionData(String role, Object ownerIdentifier) {
final CollectionPersister collectionDescriptor = sessionFactory.getMetamodel()
.collectionPersister( role );
@ -569,13 +568,13 @@ public class EnabledCaching implements CacheImplementor, DomainDataRegionBuildin
@Override
public boolean contains(Class cls, Object primaryKey) {
// JPA
return containsEntity( cls, (Serializable) primaryKey );
return containsEntity( cls, primaryKey );
}
@Override
public void evict(Class cls, Object primaryKey) {
// JPA call
evictEntityData( cls, (Serializable) primaryKey );
evictEntityData( cls, primaryKey );
}
@Override

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.dialect.identity;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -52,7 +51,7 @@ public class GetGeneratedKeysDelegate
}
@Override
public Serializable executeAndExtract(PreparedStatement insert, SharedSessionContractImplementor session)
public Object executeAndExtract(PreparedStatement insert, SharedSessionContractImplementor session)
throws SQLException {
session.getJdbcCoordinator().getResultSetReturn().executeUpdate( insert );
ResultSet rs = null;

View File

@ -112,7 +112,7 @@ public abstract class AbstractEntityEntry implements Serializable, EntityEntry {
protected AbstractEntityEntry(
final SessionFactoryImplementor factory,
final String entityName,
final Serializable id,
final Object id,
final Status status,
final Status previousStatus,
final Object[] loadedState,

View File

@ -62,7 +62,7 @@ public class BatchFetchQueueHelper {
if ( LOG.isDebugEnabled() ) {
LOG.debug( "Entities of type [" + persister.getEntityName() + "] not found; IDs: " + idSet );
}
for ( Serializable id : idSet ) {
for ( Object id : idSet ) {
removeBatchLoadableEntityKey( id, persister, session );
}
}

View File

@ -8,7 +8,6 @@ package org.hibernate.engine.internal;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import org.hibernate.AssertionFailure;
import org.hibernate.LockMode;
@ -65,7 +64,7 @@ public final class ImmutableEntityEntry extends AbstractEntityEntry {
private ImmutableEntityEntry(
final SessionFactoryImplementor factory,
final String entityName,
final Serializable id,
final Object id,
final Status status,
final Status previousStatus,
final Object[] loadedState,
@ -115,7 +114,7 @@ public final class ImmutableEntityEntry extends AbstractEntityEntry {
return new ImmutableEntityEntry(
persistenceContext.getSession().getFactory(),
(String) ois.readObject(),
(Serializable) ois.readObject(),
ois.readObject(),
Status.valueOf( (String) ois.readObject() ),
( previousStatusString = (String) ois.readObject() ).length() == 0
? null

View File

@ -8,7 +8,6 @@ package org.hibernate.engine.internal;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import org.hibernate.EntityMode;
import org.hibernate.LockMode;
@ -36,7 +35,7 @@ public final class MutableEntityEntry extends AbstractEntityEntry {
final Status status,
final Object[] loadedState,
final Object rowId,
final Serializable id,
final Object id,
final Object version,
final LockMode lockMode,
final boolean existsInDatabase,
@ -73,7 +72,7 @@ public final class MutableEntityEntry extends AbstractEntityEntry {
private MutableEntityEntry(
final SessionFactoryImplementor factory,
final String entityName,
final Serializable id,
final Object id,
final Status status,
final Status previousStatus,
final Object[] loadedState,
@ -108,7 +107,7 @@ public final class MutableEntityEntry extends AbstractEntityEntry {
return new MutableEntityEntry(
persistenceContext.getSession().getFactory(),
(String) ois.readObject(),
(Serializable) ois.readObject(),
ois.readObject(),
Status.valueOf( (String) ois.readObject() ),
( previousStatusString = (String) ois.readObject() ).length() == 0
? null

View File

@ -65,11 +65,11 @@ public class UnsavedValueFactory {
if ( unsavedValue == null ) {
if ( identifierGetter != null && constructor != null ) {
// use the id value of a newly instantiated instance as the unsaved-value
final Serializable defaultValue = (Serializable) identifierGetter.get( instantiate( constructor ) );
final Object defaultValue = identifierGetter.get( instantiate( constructor ) );
return new IdentifierValue( defaultValue );
}
else if ( identifierGetter != null && (identifierType instanceof PrimitiveType) ) {
final Serializable defaultValue = ( (PrimitiveType) identifierType ).getDefaultValue();
final Object defaultValue = ( (PrimitiveType) identifierType ).getDefaultValue();
return new IdentifierValue( defaultValue );
}
else {
@ -90,7 +90,7 @@ public class UnsavedValueFactory {
}
else {
try {
return new IdentifierValue( (Serializable) ( (IdentifierType) identifierType ).stringToObject( unsavedValue ) );
return new IdentifierValue( ( (IdentifierType) identifierType ).stringToObject( unsavedValue ) );
}
catch ( ClassCastException cce ) {
throw new MappingException( "Bad identifier type: " + identifierType.getName() );

View File

@ -133,7 +133,7 @@ public final class CollectionEntry implements Serializable {
private CollectionEntry(
String role,
Serializable snapshot,
Serializable loadedKey,
Object loadedKey,
SessionFactoryImplementor factory) {
this.role = role;
this.snapshot = snapshot;
@ -430,8 +430,8 @@ public final class CollectionEntry implements Serializable {
return new CollectionEntry(
(String) ois.readObject(),
(Serializable) ois.readObject(),
(Serializable) ois.readObject(),
(session == null ? null : session.getFactory())
ois.readObject(),
session == null ? null : session.getFactory()
);
}
}

View File

@ -70,8 +70,8 @@ public final class EntityKey implements Serializable {
return identifier;
}
public Serializable getIdentifier() {
return (Serializable) identifier;
public Object getIdentifier() {
return identifier;
}
public String getEntityName() {
@ -147,7 +147,7 @@ public final class EntityKey implements Serializable {
* @throws ClassNotFoundException Thrown by Java I/O
*/
public static EntityKey deserialize(ObjectInputStream ois, SessionFactoryImplementor sessionFactory) throws IOException, ClassNotFoundException {
final Serializable id = (Serializable) ois.readObject();
final Object id = ois.readObject();
final String entityName = (String) ois.readObject();
final EntityPersister entityPersister = sessionFactory.getEntityPersister( entityName );
return new EntityKey(id, entityPersister);

View File

@ -23,7 +23,7 @@ import org.jboss.logging.Logger;
public class IdentifierValue implements UnsavedValueStrategy {
private static final Logger LOG = CoreLogging.logger( IdentifierValue.class );
private final Serializable value;
private final Object value;
/**
* Always assume the transient instance is newly instantiated
@ -36,8 +36,8 @@ public class IdentifierValue implements UnsavedValueStrategy {
}
@Override
public Serializable getDefaultValue(Object currentValue) {
return (Serializable) currentValue;
public Object getDefaultValue(Object currentValue) {
return currentValue;
}
@Override
@ -57,8 +57,8 @@ public class IdentifierValue implements UnsavedValueStrategy {
}
@Override
public Serializable getDefaultValue(Object currentValue) {
return (Serializable) currentValue;
public Object getDefaultValue(Object currentValue) {
return currentValue;
}
@Override
@ -118,7 +118,7 @@ public class IdentifierValue implements UnsavedValueStrategy {
* Assume the transient instance is newly instantiated if
* its identifier is null or equal to <tt>value</tt>
*/
public IdentifierValue(Serializable value) {
public IdentifierValue(Object value) {
this.value = value;
}
@ -132,7 +132,7 @@ public class IdentifierValue implements UnsavedValueStrategy {
}
@Override
public Serializable getDefaultValue(Object currentValue) {
public Object getDefaultValue(Object currentValue) {
return value;
}

View File

@ -6,8 +6,6 @@
*/
package org.hibernate.event.internal;
import java.io.Serializable;
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.NonUniqueObjectException;
@ -166,7 +164,7 @@ public class DefaultLoadEventListener implements LoadEventListener {
final EntityKey parentEntityKey = session.generateEntityKey( event.getEntityId(), parentPersister );
final Object parent = doLoad( event, parentPersister, parentEntityKey, options );
final Serializable dependent = (Serializable) dependentPersister.instantiate( parent, session );
final Object dependent = dependentPersister.instantiate( parent, session );
dependentPersister.setPropertyValues( dependent, new Object[] {parent} );
final EntityKey dependentEntityKey = session.generateEntityKey( dependent, dependentPersister );
event.setEntityId( dependent );

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.event.internal;
import java.io.Serializable;
import java.util.Map;
import org.hibernate.AssertionFailure;
@ -262,7 +261,7 @@ public class DefaultMergeEventListener extends AbstractSaveEventListener impleme
private void saveTransientEntity(
Object entity,
String entityName,
Serializable requestedId,
Object requestedId,
EventSource source,
Map copyCache) {
//this bit is only *really* absolutely necessary for handling
@ -299,7 +298,7 @@ public class DefaultMergeEventListener extends AbstractSaveEventListener impleme
}
// we must clone embedded composite identifiers or we will get back the same instance that we pass in
final Serializable clonedIdentifier = (Serializable) persister.getIdentifierType().deepCopy( id, source.getFactory() );
final Object clonedIdentifier = persister.getIdentifierType().deepCopy( id, source.getFactory() );
// apply the special MERGE fetch profile and perform the resolution (Session#get)
final Object result = source.getLoadQueryInfluencers().fromInternalFetchProfile(

View File

@ -6,9 +6,7 @@
*/
package org.hibernate.event.spi;
import java.io.Serializable;
/**
/**
* An event class for merge() and saveOrUpdateCopy()
*
* @author Gavin King
@ -16,7 +14,7 @@ import java.io.Serializable;
public class MergeEvent extends AbstractEvent {
private Object original;
private Serializable requestedId;
private Object requestedId;
private String entityName;
private Object entity;
private Object result;
@ -26,7 +24,7 @@ public class MergeEvent extends AbstractEvent {
this.entityName = entityName;
}
public MergeEvent(String entityName, Object original, Serializable id, EventSource source) {
public MergeEvent(String entityName, Object original, Object id, EventSource source) {
this(entityName, original, source);
this.requestedId = id;
if ( requestedId == null ) {
@ -54,11 +52,11 @@ public class MergeEvent extends AbstractEvent {
this.original = object;
}
public Serializable getRequestedId() {
public Object getRequestedId() {
return requestedId;
}
public void setRequestedId(Serializable requestedId) {
public void setRequestedId(Object requestedId) {
this.requestedId = requestedId;
}

View File

@ -6,8 +6,6 @@
*/
package org.hibernate.event.spi;
import java.io.Serializable;
import org.hibernate.engine.spi.EntityEntry;
/**
@ -29,7 +27,7 @@ public class SaveOrUpdateEvent extends AbstractEvent {
this.entityName = entityName;
}
public SaveOrUpdateEvent(String entityName, Object original, Serializable id, EventSource source) {
public SaveOrUpdateEvent(String entityName, Object original, Object id, EventSource source) {
this(entityName, original, source);
this.requestedId = id;
if ( requestedId == null ) {

View File

@ -69,12 +69,12 @@ public final class IdentifierGeneratorHelper {
* @throws SQLException Can be thrown while accessing the result set
* @throws HibernateException Indicates a problem reading back a generated identity value.
*/
public static Serializable getGeneratedIdentity(ResultSet rs, String identifier, Type type, Dialect dialect)
public static Object getGeneratedIdentity(ResultSet rs, String identifier, Type type, Dialect dialect)
throws SQLException, HibernateException {
if ( !rs.next() ) {
throw new HibernateException( "The database returned no natively generated identity value" );
}
final Serializable id = get( rs, identifier, type, dialect );
final Object id = get( rs, identifier, type, dialect );
LOG.debugf( "Natively generated identity: %s", id );
return id;
}
@ -93,7 +93,7 @@ public final class IdentifierGeneratorHelper {
* @throws SQLException Indicates problems access the result set
* @throws IdentifierGenerationException Indicates an unknown type.
*/
public static Serializable get(ResultSet rs, String identifier, Type type, Dialect dialect)
public static Object get(ResultSet rs, String identifier, Type type, Dialect dialect)
throws SQLException, IdentifierGenerationException {
if ( ResultSetIdentifierConsumer.class.isInstance( type ) ) {
return ( (ResultSetIdentifierConsumer) type ).consumeIdentifier( rs );
@ -153,7 +153,7 @@ public final class IdentifierGeneratorHelper {
}
}
private static Serializable extractIdentifier(ResultSet rs, String identifier, Type type, Class clazz)
private static Object extractIdentifier(ResultSet rs, String identifier, Type type, Class clazz)
throws SQLException {
if ( clazz == Long.class ) {
return rs.getLong( identifier );

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.id;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -82,7 +81,7 @@ public class IdentityGenerator extends AbstractPostInsertGenerator {
}
@Override
public Serializable executeAndExtract(PreparedStatement insert, SharedSessionContractImplementor session)
public Object executeAndExtract(PreparedStatement insert, SharedSessionContractImplementor session)
throws SQLException {
ResultSet rs = session.getJdbcCoordinator().getResultSetReturn().execute( insert );
try {
@ -98,7 +97,7 @@ public class IdentityGenerator extends AbstractPostInsertGenerator {
}
}
public Serializable determineGeneratedIdentifier(SharedSessionContractImplementor session, Object entity) {
public Object determineGeneratedIdentifier(SharedSessionContractImplementor session, Object entity) {
throw new AssertionFailure( "insert statement returns generated value" );
}
}
@ -132,7 +131,7 @@ public class IdentityGenerator extends AbstractPostInsertGenerator {
}
@Override
protected Serializable getResult(
protected Object getResult(
SharedSessionContractImplementor session,
ResultSet rs,
Object object) throws SQLException {

View File

@ -5,7 +5,7 @@
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.id;
import java.io.Serializable;
import java.sql.ResultSet;
/**
@ -25,5 +25,5 @@ public interface ResultSetIdentifierConsumer {
* the identifier value.
* @return The identifier value.
*/
public Serializable consumeIdentifier(ResultSet resultSet);
public Object consumeIdentifier(ResultSet resultSet);
}

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.id;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -121,7 +120,7 @@ public class SelectGenerator extends AbstractPostInsertGenerator implements Conf
uniqueKeyType.nullSafeSet( ps, uniqueKeyValue, 1, session );
}
protected Serializable getResult(
protected Object getResult(
SharedSessionContractImplementor session,
ResultSet rs,
Object entity) throws SQLException {
@ -131,7 +130,7 @@ public class SelectGenerator extends AbstractPostInsertGenerator implements Conf
uniqueKeyPropertyName
);
}
return (Serializable) idType.nullSafeGet(
return idType.nullSafeGet(
rs,
persister.getRootTableKeyColumnNames(),
session,

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.id;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Properties;
@ -90,7 +89,7 @@ public class SequenceIdentityGenerator
}
@Override
protected Serializable executeAndExtract(PreparedStatement insert, SharedSessionContractImplementor session)
protected Object executeAndExtract(PreparedStatement insert, SharedSessionContractImplementor session)
throws SQLException {
session.getJdbcCoordinator().getResultSetReturn().executeUpdate( insert );
return IdentifierGeneratorHelper.getGeneratedIdentity(

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.id.insert;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
@ -31,7 +30,7 @@ public abstract class AbstractReturningDelegate implements InsertGeneratedIdenti
}
@Override
public final Serializable performInsert(
public final Object performInsert(
String insertSQL,
SharedSessionContractImplementor session,
Binder binder) {
@ -61,7 +60,7 @@ public abstract class AbstractReturningDelegate implements InsertGeneratedIdenti
protected abstract PreparedStatement prepare(String insertSQL, SharedSessionContractImplementor session) throws SQLException;
protected abstract Serializable executeAndExtract(PreparedStatement insert, SharedSessionContractImplementor session)
protected abstract Object executeAndExtract(PreparedStatement insert, SharedSessionContractImplementor session)
throws SQLException;
protected void releaseStatement(PreparedStatement insert, SharedSessionContractImplementor session) {

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.id.insert;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -30,7 +29,7 @@ public abstract class AbstractSelectingDelegate implements InsertGeneratedIdenti
}
@Override
public final Serializable performInsert(
public final Object performInsert(
String insertSQL,
SharedSessionContractImplementor session,
Binder binder) {
@ -123,7 +122,7 @@ public abstract class AbstractSelectingDelegate implements InsertGeneratedIdenti
*
* @throws SQLException
*/
protected abstract Serializable getResult(
protected abstract Object getResult(
SharedSessionContractImplementor session,
ResultSet rs,
Object entity) throws SQLException;

View File

@ -6,8 +6,6 @@
*/
package org.hibernate.id.insert;
import java.io.Serializable;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
/**
@ -40,6 +38,6 @@ public interface InsertGeneratedIdentifierDelegate {
*
* @return The generated identifier value.
*/
Serializable performInsert(String insertSQL, SharedSessionContractImplementor session, Binder binder);
Object performInsert(String insertSQL, SharedSessionContractImplementor session, Binder binder);
}

View File

@ -538,7 +538,7 @@ public class SessionImpl
// logically, is PersistentContext the "thing" to which an interceptor gets attached?
final Object result = persistenceContext.getEntity( key );
if ( result == null ) {
final Object newObject = getInterceptor().getEntity( key.getEntityName(), key.getIdentifier() );
final Object newObject = getInterceptor().getEntity( key.getEntityName(), (Serializable) key.getIdentifier() );
if ( newObject != null ) {
lock( newObject, LockMode.NONE );
}

View File

@ -475,7 +475,7 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
return result;
}
final Object newObject = getInterceptor().getEntity( key.getEntityName(), key.getIdentifier() );
final Object newObject = getInterceptor().getEntity( key.getEntityName(), (Serializable) key.getIdentifier() );
if ( newObject != null ) {
persistenceContext.addEntity( key, newObject );
return newObject;

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.loader.access;
import java.io.Serializable;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@ -115,7 +114,7 @@ public class SimpleNaturalIdLoadAccessImpl<T>
}
@Override
public Optional<T> loadOptional(Serializable naturalIdValue) {
public Optional<T> loadOptional(Object naturalIdValue) {
return Optional.ofNullable( load( naturalIdValue ) );
}
}

View File

@ -9,7 +9,6 @@ package org.hibernate.metamodel.model.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;

View File

@ -1899,7 +1899,7 @@ public abstract class AbstractCollectionPersister
* @deprecated Use {@link #doProcessQueuedOps(PersistentCollection, Object, SharedSessionContractImplementor)}
*/
@Deprecated
protected void doProcessQueuedOps(PersistentCollection collection, Serializable key,
protected void doProcessQueuedOps(PersistentCollection collection, Object key,
int nextIndex, SharedSessionContractImplementor session)
throws HibernateException {
doProcessQueuedOps( collection, key, session );

View File

@ -3173,7 +3173,7 @@ public abstract class AbstractEntityPersister
}
public int dehydrate(
Serializable id,
Object id,
Object[] fields,
boolean[] includeProperty,
boolean[][] includeColumns,
@ -3267,7 +3267,7 @@ public abstract class AbstractEntityPersister
*/
public Object[] hydrate(
final ResultSet rs,
final Serializable id,
final Object id,
final Object object,
final Loadable rootLoadable,
final String[][] suffixedPropertyColumns,
@ -3386,7 +3386,7 @@ public abstract class AbstractEntityPersister
* This form is used for PostInsertIdentifierGenerator-style ids (IDENTITY,
* select, etc).
*/
public Serializable insert(
public Object insert(
final Object[] fields,
final boolean[] notNull,
String sql,
@ -3999,13 +3999,13 @@ public abstract class AbstractEntityPersister
}
}
public Serializable insert(Object[] fields, Object object, SharedSessionContractImplementor session)
public Object insert(Object[] fields, Object object, SharedSessionContractImplementor session)
throws HibernateException {
// apply any pre-insert in-memory value generation
preInsertInMemoryValueGeneration( fields, object, session );
final int span = getTableSpan();
final Serializable id;
final Object id;
if ( entityMetamodel.isDynamicInsert() ) {
// For the case of dynamic-insert="true", we need to generate the INSERT SQL
boolean[] notNull = getPropertiesToInsert( fields );
@ -4631,7 +4631,7 @@ public abstract class AbstractEntityPersister
final EnhancementAsProxyLazinessInterceptor proxyInterceptor = (EnhancementAsProxyLazinessInterceptor) currentInterceptor;
final EntityKey entityKey = proxyInterceptor.getEntityKey();
final Serializable identifier = entityKey.getIdentifier();
final Object identifier = entityKey.getIdentifier();
LoadEvent loadEvent = new LoadEvent( identifier, entity, (EventSource)session, false );

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.persister.entity;
import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -85,7 +84,7 @@ public interface Loadable extends EntityPersister {
*/
Object[] hydrate(
ResultSet rs,
Serializable id,
Object id,
Object object,
Loadable rootLoadable,
String[][] suffixedPropertyColumns,

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.sql.results.graph.collection;
import java.io.Serializable;
import java.util.List;
import java.util.function.Consumer;
@ -33,7 +32,7 @@ public interface LoadingCollectionEntry {
/**
* The collection key.
*/
Serializable getKey();
Object getKey();
/**
* The collection instance being loaded

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.sql.results.graph.entity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.IdentityHashMap;
import java.util.List;
@ -603,7 +602,7 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
// return;
// }
final Serializable entityIdentifier = entityKey.getIdentifier();
final Object entityIdentifier = entityKey.getIdentifier();
if ( EntityLoadingLogger.TRACE_ENABLED ) {
EntityLoadingLogger.LOGGER.tracef(

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.sql.results.internal;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
@ -57,9 +56,9 @@ public class LoadingCollectionEntryImpl implements LoadingCollectionEntry {
return initializer;
}
@Override public Serializable getKey() {
@Override public Object getKey() {
// todo (6.0) : change from Serializable to Object
return (Serializable) key;
return key;
}
@Override public PersistentCollection getCollectionInstance() {

View File

@ -41,7 +41,6 @@ import org.hibernate.proxy.ProxyFactory;
import org.hibernate.tuple.IdentifierProperty;
import org.hibernate.tuple.Instantiator;
import org.hibernate.type.AssociationType;
import org.hibernate.type.BasicType;
import org.hibernate.type.ComponentType;
import org.hibernate.type.CompositeType;
import org.hibernate.type.EntityType;
@ -522,10 +521,10 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
}
else {
//reset the id
Serializable result = identifierProperty
Object result = identifierProperty
.getUnsavedValue()
.getDefaultValue( currentId );
setIdentifier( entity, result, session );
setIdentifier( entity, (Serializable) result, session );
//reset the version
VersionProperty versionProperty = entityMetamodel.getVersionProperty();
if ( entityMetamodel.isVersioned() ) {

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.tuple.entity;
import java.io.Serializable;
import java.util.Set;
import org.hibernate.LockMode;
@ -139,7 +138,7 @@ public final class BytecodeEnhancementMetadataPojoImpl implements BytecodeEnhanc
@Override
public PersistentAttributeInterceptable createEnhancedProxy(EntityKey entityKey, boolean addEmptyEntry, SharedSessionContractImplementor session) {
final EntityPersister persister = entityKey.getPersister();
final Serializable identifier = entityKey.getIdentifier();
final Object identifier = entityKey.getIdentifier();
final PersistenceContext persistenceContext = session.getPersistenceContext();
// first, instantiate the entity instance to use as the proxy

View File

@ -249,7 +249,7 @@ public class AnyType extends AbstractType implements CompositeType, AssociationT
public Object hydrate(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
throws HibernateException, SQLException {
final String entityName = (String) discriminatorType.nullSafeGet( rs, names[0], session, owner );
final Serializable id = (Serializable) identifierType.nullSafeGet( rs, names[1], session, owner );
final Object id = identifierType.nullSafeGet( rs, names[1], session, owner );
return new ObjectTypeCacheEntry( entityName, id );
}

View File

@ -292,7 +292,7 @@ public abstract class CollectionType extends AbstractType implements Association
return null;
}
else {
final Serializable key = (Serializable) getPersister(session)
final Object key = getPersister(session)
.getKeyType()
.assemble( cached, session, owner);
return resolveKey( key, session, owner, null );

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.type;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -427,7 +426,7 @@ public abstract class EntityType extends AbstractType implements AssociationType
public Object resolve(Object value, SharedSessionContractImplementor session, Object owner, Boolean overridingEager) throws HibernateException {
if ( value != null && !isNull( owner, session ) ) {
if ( isReferenceToPrimaryKey() ) {
return resolveIdentifier( (Serializable) value, session, overridingEager );
return resolveIdentifier( value, session, overridingEager );
}
else if ( uniqueKeyPropertyName != null ) {
return loadByUniqueKey( getAssociatedEntityName(), uniqueKeyPropertyName, value, session );
@ -654,7 +653,7 @@ public abstract class EntityType extends AbstractType implements AssociationType
*
* @throws org.hibernate.HibernateException Indicates problems performing the load.
*/
protected final Object resolveIdentifier(Serializable id, SharedSessionContractImplementor session, Boolean overridingEager) throws HibernateException {
protected final Object resolveIdentifier(Object id, SharedSessionContractImplementor session, Boolean overridingEager) throws HibernateException {
boolean isProxyUnwrapEnabled = unwrapProxy &&
getAssociatedEntityPersister( session.getFactory() )
@ -675,7 +674,7 @@ public abstract class EntityType extends AbstractType implements AssociationType
return proxyOrEntity;
}
protected final Object resolveIdentifier(Serializable id, SharedSessionContractImplementor session) throws HibernateException {
protected final Object resolveIdentifier(Object id, SharedSessionContractImplementor session) throws HibernateException {
return resolveIdentifier( id, session, null );
}

View File

@ -147,9 +147,9 @@ public class ManyToOneType extends EntityType {
// out the empty value.
final Object hydratedId = getIdentifierOrUniqueKeyType( session.getFactory() )
.hydrate( rs, names, session, null );
final Serializable id;
final Object id;
if ( hydratedId != null ) {
id = (Serializable) getIdentifierOrUniqueKeyType( session.getFactory() )
id = getIdentifierOrUniqueKeyType( session.getFactory() )
.resolve( hydratedId, session, null );
}
else {
@ -163,7 +163,7 @@ public class ManyToOneType extends EntityType {
* Register the entity as batch loadable, if enabled
*/
@SuppressWarnings({ "JavaDoc" })
private void scheduleBatchLoadIfNeeded(Serializable id, SharedSessionContractImplementor session) throws MappingException {
private void scheduleBatchLoadIfNeeded(Object id, SharedSessionContractImplementor session) throws MappingException {
//cannot batch fetch by unique key (property-ref associations)
if ( uniqueKeyPropertyName == null && id != null ) {
final EntityPersister persister = getAssociatedEntityPersister( session.getFactory() );
@ -257,8 +257,8 @@ public class ManyToOneType extends EntityType {
//TODO: currently broken for unique-key references (does not detect
// change to unique key property of the associated object)
Serializable id = assembleId( oid, session );
Object id = assembleId( oid, session );
if ( id == null ) {
return null;
@ -268,9 +268,9 @@ public class ManyToOneType extends EntityType {
}
}
private Serializable assembleId(Serializable oid, SharedSessionContractImplementor session) {
private Object assembleId(Serializable oid, SharedSessionContractImplementor session) {
//the owner of the association is not the owner of the id
return ( Serializable ) getIdentifierType( session ).assemble( oid, session, null );
return getIdentifierType( session ).assemble( oid, session, null );
}
@Override

View File

@ -182,7 +182,7 @@ public class OneToOneType extends EntityType {
@Override
public Object assemble(Serializable oid, SharedSessionContractImplementor session, Object owner) throws HibernateException {
//the owner of the association is not the owner of the id
Serializable id = ( Serializable ) getIdentifierType( session ).assemble( oid, session, null );
Object id = getIdentifierType( session ).assemble( oid, session, null );
if ( id == null ) {
return null;

View File

@ -36,5 +36,5 @@ public interface PrimitiveType<T> extends LiteralType<T> {
*
* @return The default value.
*/
public abstract Serializable getDefaultValue();
public abstract Object getDefaultValue();
}

View File

@ -112,7 +112,7 @@ public class SpecialOneToOneType extends OneToOneType {
throws HibernateException {
//TODO: currently broken for unique-key references (does not detect
// change to unique key property of the associated object)
Serializable id = (Serializable) getIdentifierType(session).assemble(oid, session, null); //the owner of the association is not the owner of the id
Object id = getIdentifierType(session).assemble(oid, session, null); //the owner of the association is not the owner of the id
if (id==null) {
return null;