From f43f668fb88578d1e16cd09e0f42d86c1e7d55fa Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Fri, 27 Jul 2018 20:43:32 +0200 Subject: [PATCH] HHH-12730 Remove the deprecated methods previouly added We don't need them as everything is now dealt with the transformer. --- .../collection/spi/PersistentCollection.java | 62 +-- .../type/AbstractStandardBasicType.java | 31 +- .../ProcedureParameterExtractionAware.java | 39 -- .../type/ProcedureParameterNamedBinder.java | 22 -- .../org/hibernate/type/SingleColumnType.java | 61 --- .../main/java/org/hibernate/type/Type.java | 358 +----------------- .../java/org/hibernate/type/VersionType.java | 29 -- .../hibernate/usertype/CompositeUserType.java | 100 +---- .../usertype/UserCollectionType.java | 47 --- .../java/org/hibernate/usertype/UserType.java | 43 --- .../hibernate/usertype/UserVersionType.java | 33 +- 11 files changed, 24 insertions(+), 801 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/collection/spi/PersistentCollection.java b/hibernate-core/src/main/java/org/hibernate/collection/spi/PersistentCollection.java index e902062235..185ed8752f 100644 --- a/hibernate-core/src/main/java/org/hibernate/collection/spi/PersistentCollection.java +++ b/hibernate-core/src/main/java/org/hibernate/collection/spi/PersistentCollection.java @@ -13,7 +13,6 @@ import java.util.Collection; import java.util.Iterator; import org.hibernate.HibernateException; -import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.loader.CollectionAliases; import org.hibernate.persister.collection.CollectionPersister; @@ -84,7 +83,7 @@ public interface PersistentCollection { * database state is now synchronized with the memory state. */ void postAction(); - + /** * Return the user-visible collection (or array) instance * @@ -103,7 +102,7 @@ public interface PersistentCollection { * @return Whether to end the read. */ boolean endRead(); - + /** * Called after initializing from cache * @@ -128,20 +127,6 @@ public interface PersistentCollection { */ boolean unsetSession(SharedSessionContractImplementor currentSession); - /** - * Disassociate this collection from the given session. - * - * @param currentSession The session we are disassociating from. Used for validations. - * - * @return true if this was currently associated with the given session - * - * @deprecated {@link #unsetSession(SharedSessionContractImplementor)} should be used instead. - */ - @Deprecated - default boolean unsetSession(SessionImplementor currentSession) { - return unsetSession( (SharedSessionContractImplementor) currentSession ); - } - /** * Associate the collection with the given session. * @@ -154,23 +139,6 @@ public interface PersistentCollection { */ boolean setCurrentSession(SharedSessionContractImplementor session) throws HibernateException; - /** - * Associate the collection with the given session. - * - * @param session The session to associate with - * - * @return false if the collection was already associated with the session - * - * @throws HibernateException if the collection was already associated - * with another open session - * - * @deprecated {@link #setCurrentSession(SharedSessionContractImplementor)} should be used instead. - */ - @Deprecated - default boolean setCurrentSession(SessionImplementor session) throws HibernateException { - return setCurrentSession( (SharedSessionContractImplementor) session ); - } - /** * Read the state of the collection from a disassembled cached value * @@ -216,7 +184,7 @@ public interface PersistentCollection { * @return The identifier value */ Object getIdentifier(Object entry, int i); - + /** * Get the index of the given collection entry * @@ -227,7 +195,7 @@ public interface PersistentCollection { * @return The index value */ Object getIndex(Object entry, int i, CollectionPersister persister); - + /** * Get the value of the given collection entry. Generally the given entry parameter value will just be returned. * Might get a different value for a duplicate entries in a Set. @@ -237,7 +205,7 @@ public interface PersistentCollection { * @return The corresponding object that is part of the collection elements. */ Object getElement(Object entry); - + /** * Get the snapshot value of the given collection entry * @@ -275,7 +243,7 @@ public interface PersistentCollection { * @return {@code true} if the given snapshot is empty */ boolean isSnapshotEmpty(Serializable snapshot); - + /** * Disassemble the collection to get it ready for the cache * @@ -387,7 +355,7 @@ public interface PersistentCollection { * @return The iterator */ Iterator queuedAdditionIterator(); - + /** * Get the "queued" orphans * @@ -396,28 +364,28 @@ public interface PersistentCollection { * @return The orphaned elements */ Collection getQueuedOrphans(String entityName); - + /** * Get the current collection key value * * @return the current collection key value */ Serializable getKey(); - + /** * Get the current role name * * @return the collection role name */ String getRole(); - + /** * Is the collection unreferenced? * * @return {@code true} if the collection is no longer referenced by an owner */ boolean isUnreferenced(); - + /** * Is the collection dirty? Note that this is only * reliable during the flush cycle, after the @@ -437,19 +405,19 @@ public interface PersistentCollection { * to the database. */ void clearDirty(); - + /** * Get the snapshot cached by the collection instance * * @return The internally stored snapshot state */ Serializable getStoredSnapshot(); - + /** * Mark the collection as dirty */ void dirty(); - + /** * Called before inserting rows, to ensure that any surrogate keys * are fully generated @@ -476,5 +444,5 @@ public interface PersistentCollection { * @return The orphans */ Collection getOrphans(Serializable snapshot, String entityName); - + } diff --git a/hibernate-core/src/main/java/org/hibernate/type/AbstractStandardBasicType.java b/hibernate-core/src/main/java/org/hibernate/type/AbstractStandardBasicType.java index 1cc1878a0e..d45e85d653 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/AbstractStandardBasicType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/AbstractStandardBasicType.java @@ -20,7 +20,6 @@ import org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer; import org.hibernate.engine.jdbc.Size; import org.hibernate.engine.spi.Mapping; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.internal.util.collections.ArrayHelper; import org.hibernate.type.descriptor.WrapperOptions; @@ -107,13 +106,13 @@ public abstract class AbstractStandardBasicType protected Size getDictatedSize() { return dictatedSize; } - + // final implementations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public final JavaTypeDescriptor getJavaTypeDescriptor() { return javaTypeDescriptor; } - + public final void setJavaTypeDescriptor( JavaTypeDescriptor javaTypeDescriptor ) { this.javaTypeDescriptor = javaTypeDescriptor; } @@ -258,15 +257,6 @@ public abstract class AbstractStandardBasicType return nullSafeGet( rs, name, (WrapperOptions) session ); } - /** - * @deprecated {@link #nullSafeGet(ResultSet, String, SharedSessionContractImplementor)} - * should be used instead. - */ - @Deprecated - public final T nullSafeGet(ResultSet rs, String name, final SessionImplementor session) throws SQLException { - return nullSafeGet( rs, name, (SharedSessionContractImplementor) session ); - } - protected final T nullSafeGet(ResultSet rs, String name, WrapperOptions options) throws SQLException { return remapSqlTypeDescriptor( options ).getExtractor( javaTypeDescriptor ).extract( rs, name, options ); } @@ -275,14 +265,6 @@ public abstract class AbstractStandardBasicType return nullSafeGet( rs, name, session ); } - /** - * @deprecated {@link #get(ResultSet, String, SharedSessionContractImplementor)} should be used instead. - */ - @Deprecated - public Object get(ResultSet rs, String name, SessionImplementor session) throws HibernateException, SQLException { - return get( rs, name, (SharedSessionContractImplementor) session ); - } - @Override @SuppressWarnings({ "unchecked" }) public final void nullSafeSet( @@ -306,15 +288,6 @@ public abstract class AbstractStandardBasicType nullSafeSet( st, value, index, session ); } - /** - * @deprecated {@link #set(PreparedStatement, Object, int, SharedSessionContractImplementor)} - * should be used instead. - */ - @Deprecated - public void set(PreparedStatement st, T value, int index, SessionImplementor session) throws HibernateException, SQLException { - set( st, value, index, (SharedSessionContractImplementor) session ); - } - @Override @SuppressWarnings({ "unchecked" }) public final String toLoggableString(Object value, SessionFactoryImplementor factory) { diff --git a/hibernate-core/src/main/java/org/hibernate/type/ProcedureParameterExtractionAware.java b/hibernate-core/src/main/java/org/hibernate/type/ProcedureParameterExtractionAware.java index 32a57ae4fc..6c3cce7b6c 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/ProcedureParameterExtractionAware.java +++ b/hibernate-core/src/main/java/org/hibernate/type/ProcedureParameterExtractionAware.java @@ -9,7 +9,6 @@ package org.hibernate.type; import java.sql.CallableStatement; import java.sql.SQLException; -import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; /** @@ -40,25 +39,6 @@ public interface ProcedureParameterExtractionAware { */ T extract(CallableStatement statement, int startIndex, SharedSessionContractImplementor session) throws SQLException; - /** - * Perform the extraction - * - * @param statement The CallableStatement from which to extract the parameter value(s). - * @param startIndex The parameter index from which to start extracting; assumes the values (if multiple) are contiguous - * @param session The originating session - * - * @return The extracted value. - * - * @throws SQLException Indicates an issue calling into the CallableStatement - * @throws IllegalStateException Thrown if this method is called on instances that return {@code false} for {@link #canDoExtraction} - * - * @deprecated {@link #extract(CallableStatement, int, SharedSessionContractImplementor)} should be used instead. - */ - @Deprecated - default T extract(CallableStatement statement, int startIndex, SessionImplementor session) throws SQLException { - return extract( statement, startIndex, (SharedSessionContractImplementor) session ); - } - /** * Perform the extraction * @@ -72,23 +52,4 @@ public interface ProcedureParameterExtractionAware { * @throws IllegalStateException Thrown if this method is called on instances that return {@code false} for {@link #canDoExtraction} */ T extract(CallableStatement statement, String[] paramNames, SharedSessionContractImplementor session) throws SQLException; - - /** - * Perform the extraction - * - * @param statement The CallableStatement from which to extract the parameter value(s). - * @param paramNames The parameter names. - * @param session The originating session - * - * @return The extracted value. - * - * @throws SQLException Indicates an issue calling into the CallableStatement - * @throws IllegalStateException Thrown if this method is called on instances that return {@code false} for {@link #canDoExtraction} - * - * @deprecated {@link #extract(CallableStatement, String[], SharedSessionContractImplementor)} should be used instead. - */ - @Deprecated - default T extract(CallableStatement statement, String[] paramNames, SessionImplementor session) throws SQLException { - return extract( statement, paramNames, (SharedSessionContractImplementor) session ); - } } diff --git a/hibernate-core/src/main/java/org/hibernate/type/ProcedureParameterNamedBinder.java b/hibernate-core/src/main/java/org/hibernate/type/ProcedureParameterNamedBinder.java index 7e1638026c..c69661a9f1 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/ProcedureParameterNamedBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/type/ProcedureParameterNamedBinder.java @@ -10,7 +10,6 @@ import java.sql.CallableStatement; import java.sql.SQLException; import org.hibernate.HibernateException; -import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; /** @@ -42,25 +41,4 @@ public interface ProcedureParameterNamedBinder { * @throws SQLException An error from the JDBC driver */ void nullSafeSet(CallableStatement statement, Object value, String name, SharedSessionContractImplementor session) throws SQLException; - - /** - * Bind a value to the JDBC prepared statement, ignoring some columns as dictated by the 'settable' parameter. - * Implementors should handle the possibility of null values. - * Does not support multi-column type - * - * @param statement The CallableStatement to which to bind - * @param value the object to write - * @param name parameter bind name - * @param session The originating session - * - * @throws HibernateException An error from Hibernate - * @throws SQLException An error from the JDBC driver - * - * @deprecated {@link #nullSafeSet(CallableStatement, Object, String, SharedSessionContractImplementor)} - * should be used instead. - */ - @Deprecated - default void nullSafeSet(CallableStatement statement, Object value, String name, SessionImplementor session) throws SQLException { - nullSafeSet( statement, value, name, (SharedSessionContractImplementor) session ); - } } diff --git a/hibernate-core/src/main/java/org/hibernate/type/SingleColumnType.java b/hibernate-core/src/main/java/org/hibernate/type/SingleColumnType.java index b0185e3b0c..dbf8ee4ca9 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/SingleColumnType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/SingleColumnType.java @@ -11,7 +11,6 @@ import java.sql.ResultSet; import java.sql.SQLException; import org.hibernate.HibernateException; -import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; /** @@ -41,26 +40,6 @@ public interface SingleColumnType extends Type { */ T nullSafeGet(ResultSet rs, String name, SharedSessionContractImplementor session) throws HibernateException, SQLException; - /** - * Get a column value from a result set by name. - * - * @param rs The result set from which to extract the value. - * @param name The name of the value to extract. - * @param session The session from which the request originates - * - * @return The extracted value. - * - * @throws org.hibernate.HibernateException Generally some form of mismatch error. - * @throws java.sql.SQLException Indicates problem making the JDBC call(s). - * - * @deprecated {@link #nullSafeGet(ResultSet, String, SharedSessionContractImplementor)} - * should be used instead. - */ - @Deprecated - default T nullSafeGet(ResultSet rs, String name, final SessionImplementor session) throws SQLException { - return nullSafeGet( rs, name, (SharedSessionContractImplementor) session ); - } - /** * Get a column value from a result set, without worrying about the possibility of null values. * @@ -75,25 +54,6 @@ public interface SingleColumnType extends Type { */ Object get(ResultSet rs, String name, SharedSessionContractImplementor session) throws HibernateException, SQLException; - /** - * Get a column value from a result set, without worrying about the possibility of null values. - * - * @param rs The result set from which to extract the value. - * @param name The name of the value to extract. - * @param session The session from which the request originates - * - * @return The extracted value. - * - * @throws org.hibernate.HibernateException Generally some form of mismatch error. - * @throws java.sql.SQLException Indicates problem making the JDBC call(s). - * - * @deprecated {@link #get(ResultSet, String, SharedSessionContractImplementor)} should be used instead. - */ - @Deprecated - default Object get(ResultSet rs, String name, SessionImplementor session) throws HibernateException, SQLException { - return get( rs, name, (SharedSessionContractImplementor) session ); - } - /** * Set a parameter value without worrying about the possibility of null * values. Called from {@link #nullSafeSet} after nullness checks have @@ -108,25 +68,4 @@ public interface SingleColumnType extends Type { * @throws java.sql.SQLException Indicates problem making the JDBC call(s). */ void set(PreparedStatement st, T value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException; - - /** - * Set a parameter value without worrying about the possibility of null - * values. Called from {@link #nullSafeSet} after nullness checks have - * been performed. - * - * @param st The statement into which to bind the parameter value. - * @param value The parameter value to bind. - * @param index The position or index at which to bind the param value. - * @param session The session from which the request originates - * - * @throws org.hibernate.HibernateException Generally some form of mismatch error. - * @throws java.sql.SQLException Indicates problem making the JDBC call(s). - * - * @deprecated {@link #set(PreparedStatement, Object, int, SharedSessionContractImplementor)} - * should be used instead. - */ - @Deprecated - default void set(PreparedStatement st, T value, int index, SessionImplementor session) throws HibernateException, SQLException { - set( st, value, index, (SharedSessionContractImplementor) session ); - } } diff --git a/hibernate-core/src/main/java/org/hibernate/type/Type.java b/hibernate-core/src/main/java/org/hibernate/type/Type.java index 9895ea0e65..0008c0cc7e 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/Type.java +++ b/hibernate-core/src/main/java/org/hibernate/type/Type.java @@ -17,7 +17,6 @@ import org.hibernate.MappingException; import org.hibernate.engine.jdbc.Size; import org.hibernate.engine.spi.Mapping; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; /** @@ -223,7 +222,7 @@ public interface Type extends Serializable { * @throws HibernateException A problem occurred calculating the hash code */ int getHashCode(Object x, SessionFactoryImplementor factory) throws HibernateException; - + /** * Perform a {@link java.util.Comparator} style comparison between values * @@ -236,7 +235,7 @@ public interface Type extends Serializable { /** * Should the parent be considered dirty, given both the old and current value? - * + * * @param old the old value * @param current the current value * @param session The session from which the request originated. @@ -247,26 +246,6 @@ public interface Type extends Serializable { */ boolean isDirty(Object old, Object current, SharedSessionContractImplementor session) throws HibernateException; - /** - * Should the parent be considered dirty, given both the old and current value? - * - * @param old the old value - * @param current the current value - * @param session The session from which the request originated. - * - * @return true if the field is dirty - * - * @throws HibernateException A problem occurred performing the checking - * - * @deprecated {@link #isDirty(Object, Object, SharedSessionContractImplementor)} - * should be used instead. - */ - @Deprecated - default boolean isDirty(Object old, Object current, SessionImplementor session) throws HibernateException { - return isDirty( old, current, (SharedSessionContractImplementor) session ); - } - - /** * Should the parent be considered dirty, given both the old and current value? * @@ -282,27 +261,6 @@ public interface Type extends Serializable { boolean isDirty(Object oldState, Object currentState, boolean[] checkable, SharedSessionContractImplementor session) throws HibernateException; - /** - * Should the parent be considered dirty, given both the old and current value? - * - * @param oldState the old value - * @param currentState the current value - * @param checkable An array of booleans indicating which columns making up the value are actually checkable - * @param session The session from which the request originated. - * - * @return true if the field is dirty - * - * @throws HibernateException A problem occurred performing the checking - * - * @deprecated {@link #isDirty(Object, Object, boolean[], SharedSessionContractImplementor)} - * should be used instead. - */ - @Deprecated - default boolean isDirty(Object oldState, Object currentState, boolean[] checkable, SessionImplementor session) - throws HibernateException { - return isDirty( oldState, currentState, checkable, (SharedSessionContractImplementor) session ); - } - /** * Has the value been modified compared to the current database state? The difference between this * and the {@link #isDirty} methods is that here we need to account for "partially" built values. This is really @@ -325,34 +283,6 @@ public interface Type extends Serializable { SharedSessionContractImplementor session) throws HibernateException; - /** - * Has the value been modified compared to the current database state? The difference between this - * and the {@link #isDirty} methods is that here we need to account for "partially" built values. This is really - * only an issue with association types. For most type implementations it is enough to simply delegate to - * {@link #isDirty} here/ - * - * @param dbState the database state, in a "hydrated" form, with identifiers unresolved - * @param currentState the current state of the object - * @param checkable which columns are actually updatable - * @param session The session from which the request originated. - * - * @return true if the field has been modified - * - * @throws HibernateException A problem occurred performing the checking - * - * @deprecated {@link #isModified(Object, Object, boolean[], SharedSessionContractImplementor)} - * should be used instead. - */ - @Deprecated - default boolean isModified( - Object dbState, - Object currentState, - boolean[] checkable, - SessionImplementor session) - throws HibernateException { - return isModified( dbState, currentState, checkable, (SharedSessionContractImplementor) session ); - } - /** * Extract a value of the {@link #getReturnedClass() mapped class} from the JDBC result set. Implementors * should handle possibility of null values. @@ -372,31 +302,6 @@ public interface Type extends Serializable { Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException; - /** - * Extract a value of the {@link #getReturnedClass() mapped class} from the JDBC result set. Implementors - * should handle possibility of null values. - * - * @param rs The result set from which to extract value. - * @param names the column names making up this type value (use to read from result set) - * @param session The originating session - * @param owner the parent entity - * - * @return The extracted value - * - * @throws HibernateException An error from Hibernate - * @throws SQLException An error from the JDBC driver - * - * @see Type#hydrate(ResultSet, String[], SharedSessionContractImplementor, Object) alternative, 2-phase property initialization - * - * @deprecated {@link #nullSafeGet(ResultSet, String[], SharedSessionContractImplementor, Object)} - * should be used instead. - */ - @Deprecated - default Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) - throws HibernateException, SQLException { - return nullSafeGet( rs, names, (SharedSessionContractImplementor) session, owner ); - } - /** * Extract a value of the {@link #getReturnedClass() mapped class} from the JDBC result set. Implementors * should handle possibility of null values. This form might be called if the type is known to be a @@ -415,30 +320,6 @@ public interface Type extends Serializable { Object nullSafeGet(ResultSet rs, String name, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException; - /** - * Extract a value of the {@link #getReturnedClass() mapped class} from the JDBC result set. Implementors - * should handle possibility of null values. This form might be called if the type is known to be a - * single-column type. - * - * @param rs The result set from which to extract value. - * @param name the column name making up this type value (use to read from result set) - * @param session The originating session - * @param owner the parent entity - * - * @return The extracted value - * - * @throws HibernateException An error from Hibernate - * @throws SQLException An error from the JDBC driver - * - * @deprecated {@link #nullSafeGet(ResultSet, String, SharedSessionContractImplementor, Object)} - * should be used instead. - */ - @Deprecated - default Object nullSafeGet(ResultSet rs, String name, SessionImplementor session, Object owner) - throws HibernateException, SQLException { - return nullSafeGet( rs, name, (SharedSessionContractImplementor) session, owner ); - } - /** * Bind a value represented by an instance of the {@link #getReturnedClass() mapped class} to the JDBC prepared * statement, ignoring some columns as dictated by the 'settable' parameter. Implementors should handle the @@ -461,34 +342,6 @@ public interface Type extends Serializable { SharedSessionContractImplementor session) throws HibernateException, SQLException; - /** - * Bind a value represented by an instance of the {@link #getReturnedClass() mapped class} to the JDBC prepared - * statement, ignoring some columns as dictated by the 'settable' parameter. Implementors should handle the - * possibility of null values. A multi-column type should bind parameters starting from index. - * - * @param st The JDBC prepared statement to which to bind - * @param value the object to write - * @param index starting parameter bind index - * @param settable an array indicating which columns to bind/ignore - * @param session The originating session - * - * @throws HibernateException An error from Hibernate - * @throws SQLException An error from the JDBC driver - * - * @deprecated {@link #nullSafeSet(PreparedStatement, Object, int, boolean[], SharedSessionContractImplementor)} - * should be used instead. - */ - @Deprecated - default void nullSafeSet( - PreparedStatement st, - Object value, - int index, - boolean[] settable, - SessionImplementor session) - throws HibernateException, SQLException { - nullSafeSet( st, value, index, settable, (SharedSessionContractImplementor) session ); - } - /** * Bind a value represented by an instance of the {@link #getReturnedClass() mapped class} to the JDBC prepared * statement. Implementors should handle possibility of null values. A multi-column type should bind parameters @@ -505,28 +358,6 @@ public interface Type extends Serializable { void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException; - /** - * Bind a value represented by an instance of the {@link #getReturnedClass() mapped class} to the JDBC prepared - * statement. Implementors should handle possibility of null values. A multi-column type should bind parameters - * starting from index. - * - * @param st The JDBC prepared statement to which to bind - * @param value the object to write - * @param index starting parameter bind index - * @param session The originating session - * - * @throws HibernateException An error from Hibernate - * @throws SQLException An error from the JDBC driver - * - * @deprecated {@link #nullSafeSet(PreparedStatement, Object, int, SharedSessionContractImplementor)} - * should be used instead. - */ - @Deprecated - default void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) - throws HibernateException, SQLException { - nullSafeSet( st, value, index, (SharedSessionContractImplementor) session ); - } - /** * Generate a representation of the value for logging purposes. * @@ -584,27 +415,6 @@ public interface Type extends Serializable { */ Serializable disassemble(Object value, SharedSessionContractImplementor session, Object owner) throws HibernateException; - /** - * Return a disassembled representation of the object. This is the value Hibernate will use in second level - * caching, so care should be taken to break values down to their simplest forms; for entities especially, this - * means breaking them down into their constituent parts. - * - * @param value the value to cache - * @param session the originating session - * @param owner optional parent entity object (needed for collections) - * - * @return the disassembled, deep cloned state - * - * @throws HibernateException An error from Hibernate - * - * @deprecated {@link #disassemble(Object, SharedSessionContractImplementor, Object)} - * should be used instead. - */ - @Deprecated - default Serializable disassemble(Object value, SessionImplementor session, Object owner) throws HibernateException { - return disassemble( value, (SharedSessionContractImplementor) session, owner ); - } - /** * Reconstruct the object from its disassembled state. This method is the reciprocal of {@link #disassemble} * @@ -618,25 +428,6 @@ public interface Type extends Serializable { */ Object assemble(Serializable cached, SharedSessionContractImplementor session, Object owner) throws HibernateException; - /** - * Reconstruct the object from its disassembled state. This method is the reciprocal of {@link #disassemble} - * - * @param cached the disassembled state from the cache - * @param session the originating session - * @param owner the parent entity object - * - * @return the (re)assembled object - * - * @throws HibernateException An error from Hibernate - * - * @deprecated {@link #assemble(Serializable, SharedSessionContractImplementor, Object)} - * should be used instead. - */ - @Deprecated - default Object assemble(Serializable cached, SessionImplementor session, Object owner) throws HibernateException { - return assemble( cached, (SharedSessionContractImplementor) session, owner ); - } - /** * Called before assembling a query result set from the query cache, to allow batch fetching * of entities missing from the second-level cache. @@ -646,21 +437,6 @@ public interface Type extends Serializable { */ void beforeAssemble(Serializable cached, SharedSessionContractImplementor session); - /** - * Called before assembling a query result set from the query cache, to allow batch fetching - * of entities missing from the second-level cache. - * - * @param cached The key - * @param session The originating session - * - * @deprecated {@link #beforeAssemble(Serializable, SharedSessionContractImplementor)} should - * be used instead - */ - @Deprecated - default void beforeAssemble(Serializable cached, SessionImplementor session) { - beforeAssemble( cached, (SharedSessionContractImplementor) session ); - } - /** * Extract a value from the JDBC result set. This is useful for 2-phase property initialization - the second * phase is a call to {@link #resolve} @@ -668,7 +444,7 @@ public interface Type extends Serializable { *
  • in the case of an entity or collection type, the key
  • *
  • otherwise, the value itself
  • * - * + * * @param rs The JDBC result set * @param names the column names making up this type value (use to read from result set) * @param session The originating session @@ -684,53 +460,12 @@ public interface Type extends Serializable { Object hydrate(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException; - /** - * Extract a value from the JDBC result set. This is useful for 2-phase property initialization - the second - * phase is a call to {@link #resolve} - * This hydrated value will be either:
      - *
    • in the case of an entity or collection type, the key
    • - *
    • otherwise, the value itself
    • - *
    - * - * @param rs The JDBC result set - * @param names the column names making up this type value (use to read from result set) - * @param session The originating session - * @param owner the parent entity - * - * @return An entity or collection key, or an actual value. - * - * @throws HibernateException An error from Hibernate - * @throws SQLException An error from the JDBC driver - * - * @see #resolve - * - * @deprecated {@link #hydrate(ResultSet, String[], SharedSessionContractImplementor, Object)} - * should be used instead. - */ - @Deprecated - default Object hydrate(ResultSet rs, String[] names, SessionImplementor session, Object owner) - throws HibernateException, SQLException { - return hydrate( rs, names, (SharedSessionContractImplementor) session, owner ); - } - /** * @see #resolve(Object, SharedSessionContractImplementor, Object, Boolean) */ Object resolve(Object value, SharedSessionContractImplementor session, Object owner) throws HibernateException; - /** - * @see #resolve(Object, SharedSessionContractImplementor, Object, Boolean) - * - * @deprecated {@link #resolve(Object, SharedSessionContractImplementor, Object)} - * should be used instead. - */ - @Deprecated - default Object resolve(Object value, SessionImplementor session, Object owner) - throws HibernateException { - return resolve( value, (SharedSessionContractImplementor) session, owner ); - } - /** * The second phase of 2-phase loading. Only really pertinent for entities and collections. Here we resolve the * identifier to an entity or collection instance @@ -767,27 +502,6 @@ public interface Type extends Serializable { Object semiResolve(Object value, SharedSessionContractImplementor session, Object owner) throws HibernateException; - /** - * Given a hydrated, but unresolved value, return a value that may be used to reconstruct property-ref - * associations. - * - * @param value The unresolved, hydrated value - * @param session THe originating session - * @param owner The value owner - * - * @return The semi-resolved value - * - * @throws HibernateException An error from Hibernate - * - * @deprecated {@link #semiResolve(Object, SharedSessionContractImplementor, Object)} - * should be used instead. - */ - @Deprecated - default Object semiResolve(Object value, SessionImplementor session, Object owner) - throws HibernateException { - return semiResolve( value, (SharedSessionContractImplementor) session, owner ); - } - /** * As part of 2-phase loading, when we perform resolving what is the resolved type for this type? Generally * speaking the type and its semi-resolved type will be the same. The main deviation from this is in the @@ -823,36 +537,6 @@ public interface Type extends Serializable { Object owner, Map copyCache) throws HibernateException; - /** - * During merge, replace the existing (target) value in the entity we are merging to - * with a new (original) value from the detached entity we are merging. For immutable - * objects, or null values, it is safe to simply return the first parameter. For - * mutable objects, it is safe to return a copy of the first parameter. For objects - * with component values, it might make sense to recursively replace component values. - * - * @param original the value from the detached entity being merged - * @param target the value in the managed entity - * @param session The originating session - * @param owner The owner of the value - * @param copyCache The cache of already copied/replaced values - * - * @return the value to be merged - * - * @throws HibernateException An error from Hibernate - * - * @deprecated {@link #replace(Object, Object, SharedSessionContractImplementor, Object, Map)} - * should be used instead. - */ - @Deprecated - default Object replace( - Object original, - Object target, - SessionImplementor session, - Object owner, - Map copyCache) throws HibernateException { - return replace( original, target, (SharedSessionContractImplementor) session, owner, copyCache ); - } - /** * During merge, replace the existing (target) value in the entity we are merging to * with a new (original) value from the detached entity we are merging. For immutable @@ -879,47 +563,15 @@ public interface Type extends Serializable { Map copyCache, ForeignKeyDirection foreignKeyDirection) throws HibernateException; - /** - * During merge, replace the existing (target) value in the entity we are merging to - * with a new (original) value from the detached entity we are merging. For immutable - * objects, or null values, it is safe to simply return the first parameter. For - * mutable objects, it is safe to return a copy of the first parameter. For objects - * with component values, it might make sense to recursively replace component values. - * - * @param original the value from the detached entity being merged - * @param target the value in the managed entity - * @param session The originating session - * @param owner The owner of the value - * @param copyCache The cache of already copied/replaced values - * @param foreignKeyDirection For associations, which direction does the foreign key point? - * - * @return the value to be merged - * - * @throws HibernateException An error from Hibernate - * - * @deprecated {@link #replace(Object, Object, SharedSessionContractImplementor, Object, Map, ForeignKeyDirection)} - * should be used instead. - */ - @Deprecated - default Object replace( - Object original, - Object target, - SessionImplementor session, - Object owner, - Map copyCache, - ForeignKeyDirection foreignKeyDirection) throws HibernateException { - return replace( original, target, (SharedSessionContractImplementor) session, owner, copyCache, foreignKeyDirection ); - } - /** * Given an instance of the type, return an array of boolean, indicating * which mapped columns would be null. - * + * * @param value an instance of the type * @param mapping The mapping abstraction * * @return array indicating column nullness for a value instance */ boolean[] toColumnNullness(Object value, Mapping mapping); - + } diff --git a/hibernate-core/src/main/java/org/hibernate/type/VersionType.java b/hibernate-core/src/main/java/org/hibernate/type/VersionType.java index 556c68ee2a..26f741a6ae 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/VersionType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/VersionType.java @@ -8,9 +8,7 @@ package org.hibernate.type; import java.util.Comparator; -import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.internal.SessionImpl; /** * Additional contract for types which may be used to version (and optimistic lock) data. @@ -27,19 +25,6 @@ public interface VersionType extends Type { */ T seed(SharedSessionContractImplementor session); - /** - * Generate an initial version. - * - * @param session The session from which this request originates. - * @return an instance of the type - * - * @deprecated {@link #seed(SharedSessionContractImplementor)} should be used instead. - */ - @Deprecated - default T seed(SessionImplementor session) { - return seed( (SharedSessionContractImplementor) session ); - } - /** * Increment the version. * @@ -49,20 +34,6 @@ public interface VersionType extends Type { */ T next(T current, SharedSessionContractImplementor session); - /** - * Increment the version. - * - * @param session The session from which this request originates. - * @param current the current version - * @return an instance of the type - * - * @deprecated {@link #next(Object, SharedSessionContractImplementor)} should be used instead. - */ - @Deprecated - default T next(T current, SessionImplementor session) { - return next( current, (SharedSessionContractImplementor) session ); - } - /** * Get a comparator for version values. * diff --git a/hibernate-core/src/main/java/org/hibernate/usertype/CompositeUserType.java b/hibernate-core/src/main/java/org/hibernate/usertype/CompositeUserType.java index 738ed6b87b..85130a0bc0 100644 --- a/hibernate-core/src/main/java/org/hibernate/usertype/CompositeUserType.java +++ b/hibernate-core/src/main/java/org/hibernate/usertype/CompositeUserType.java @@ -11,7 +11,6 @@ import java.sql.ResultSet; import java.sql.SQLException; import org.hibernate.HibernateException; -import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.type.Type; @@ -88,7 +87,7 @@ public interface CompositeUserType { * @throws HibernateException */ boolean equals(Object x, Object y) throws HibernateException; - + /** * Get a hashcode for the instance, consistent with persistence "equality" */ @@ -108,27 +107,6 @@ public interface CompositeUserType { */ Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException; - /** - * Retrieve an instance of the mapped class from a JDBC resultset. Implementors - * should handle possibility of null values. - * - * @param rs a JDBC result set - * @param names the column names - * @param session - * @param owner the containing entity - * @return Object - * @throws HibernateException - * @throws SQLException - * - * @deprecated {@link #nullSafeGet(ResultSet, String[], SharedSessionContractImplementor, Object)} - * should be used instead. - */ - @Deprecated - default Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) - throws HibernateException, SQLException { - return nullSafeGet( rs, names, (SharedSessionContractImplementor) session, owner ); - } - /** * Write an instance of the mapped class to a prepared statement. Implementors * should handle possibility of null values. A multi-column type should be written @@ -143,26 +121,6 @@ public interface CompositeUserType { */ void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException; - /** - * Write an instance of the mapped class to a prepared statement. Implementors - * should handle possibility of null values. A multi-column type should be written - * to parameters starting from index. - * - * @param st a JDBC prepared statement - * @param value the object to write - * @param index statement parameter index - * @param session - * @throws HibernateException - * @throws SQLException - * - * @deprecated {@link #nullSafeSet(PreparedStatement, Object, int, SharedSessionContractImplementor)} - * should be used instead. - */ - @Deprecated - default void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) - throws HibernateException, SQLException { - nullSafeSet( st, value, index, (SharedSessionContractImplementor) session ); - } /** * Return a deep copy of the persistent state, stopping at entities and at collections. * @@ -192,24 +150,6 @@ public interface CompositeUserType { */ Serializable disassemble(Object value, SharedSessionContractImplementor session) throws HibernateException; - /** - * Transform the object into its cacheable representation. At the very least this - * method should perform a deep copy. That may not be enough for some implementations, - * however; for example, associations must be cached as identifier values. (optional - * operation) - * - * @param value the object to be cached - * @param session - * @return a cachable representation of the object - * @throws HibernateException - * - * @deprecated {@link #disassemble(Object, SharedSessionContractImplementor)} should be used instead. - */ - @Deprecated - default Serializable disassemble(Object value, SessionImplementor session) throws HibernateException { - return disassemble( value, (SharedSessionContractImplementor) session ); - } - /** * Reconstruct an object from the cacheable representation. At the very least this * method should perform a deep copy. (optional operation) @@ -222,25 +162,6 @@ public interface CompositeUserType { */ Object assemble(Serializable cached, SharedSessionContractImplementor session, Object owner) throws HibernateException; - /** - * Reconstruct an object from the cacheable representation. At the very least this - * method should perform a deep copy. (optional operation) - * - * @param cached the object to be cached - * @param session - * @param owner the owner of the cached object - * @return a reconstructed object from the cachable representation - * @throws HibernateException - * - * @deprecated {@link #assemble(Serializable, SharedSessionContractImplementor, Object)} should - * be used instead. - */ - @Deprecated - default Object assemble(Serializable cached, SessionImplementor session, Object owner) - throws HibernateException { - return assemble( cached, (SharedSessionContractImplementor) session, owner ); - } - /** * During merge, replace the existing (target) value in the entity we are merging to * with a new (original) value from the detached entity we are merging. For immutable @@ -252,23 +173,4 @@ public interface CompositeUserType { * @throws HibernateException */ Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner) throws HibernateException; - - /** - * During merge, replace the existing (target) value in the entity we are merging to - * with a new (original) value from the detached entity we are merging. For immutable - * objects, or null values, it is safe to simply return the first parameter. For - * mutable objects, it is safe to return a copy of the first parameter. However, since - * composite user types often define component values, it might make sense to recursively - * replace component values in the target object. - * - * @throws HibernateException - * - * @deprecated {@link #replace(Object, Object, SharedSessionContractImplementor, Object)} - * should be used instead. - */ - @Deprecated - default Object replace(Object original, Object target, SessionImplementor session, Object owner) - throws HibernateException { - return replace( original, target, (SharedSessionContractImplementor) session, owner ); - } } diff --git a/hibernate-core/src/main/java/org/hibernate/usertype/UserCollectionType.java b/hibernate-core/src/main/java/org/hibernate/usertype/UserCollectionType.java index 1a6d2c6406..5856c3534d 100644 --- a/hibernate-core/src/main/java/org/hibernate/usertype/UserCollectionType.java +++ b/hibernate-core/src/main/java/org/hibernate/usertype/UserCollectionType.java @@ -11,7 +11,6 @@ import java.util.Map; import org.hibernate.HibernateException; import org.hibernate.collection.spi.PersistentCollection; -import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.persister.collection.CollectionPersister; @@ -29,33 +28,11 @@ public interface UserCollectionType { PersistentCollection instantiate(SharedSessionContractImplementor session, CollectionPersister persister) throws HibernateException; - /** - * Instantiate an uninitialized instance of the collection wrapper - * - * @deprecated {@link #instantiate(SharedSessionContractImplementor, CollectionPersister)} - * should be used instead. - */ - @Deprecated - default PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister) - throws HibernateException { - return instantiate( (SharedSessionContractImplementor) session, persister ); - } - /** * Wrap an instance of a collection */ PersistentCollection wrap(SharedSessionContractImplementor session, Object collection); - /** - * Wrap an instance of a collection - * - * @deprecated {@link #wrap(SharedSessionContractImplementor, Object)} should be used instead. - */ - @Deprecated - default PersistentCollection wrap(SessionImplementor session, Object collection) { - return wrap( (SharedSessionContractImplementor) session, collection ); - } - /** * Return an iterator over the elements of this collection - the passed collection * instance may or may not be a wrapper @@ -83,30 +60,6 @@ public interface UserCollectionType { Map copyCache, SharedSessionContractImplementor session) throws HibernateException; - /** - * Replace the elements of a collection with the elements of another collection - * - * @deprecated {@link #replaceElements(Object, Object, CollectionPersister, Object, Map, SharedSessionContractImplementor)} - * should be used instead. - */ - @Deprecated - default Object replaceElements( - Object original, - Object target, - CollectionPersister persister, - Object owner, - Map copyCache, - SessionImplementor session) throws HibernateException { - return replaceElements( - original, - target, - persister, - owner, - copyCache, - (SharedSessionContractImplementor) session - ); - } - /** * Instantiate an empty instance of the "underlying" collection (not a wrapper), * but with the given anticipated size (i.e. accounting for initial size diff --git a/hibernate-core/src/main/java/org/hibernate/usertype/UserType.java b/hibernate-core/src/main/java/org/hibernate/usertype/UserType.java index 3cf60ff758..21cac8b61e 100644 --- a/hibernate-core/src/main/java/org/hibernate/usertype/UserType.java +++ b/hibernate-core/src/main/java/org/hibernate/usertype/UserType.java @@ -12,7 +12,6 @@ import java.sql.ResultSet; import java.sql.SQLException; import org.hibernate.HibernateException; -import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; /** @@ -94,26 +93,6 @@ public interface UserType { */ Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException; - /** - * Retrieve an instance of the mapped class from a JDBC resultset. Implementors - * should handle possibility of null values. - * - * @param rs a JDBC result set - * @param names the column names - * @param session - * @param owner the containing entity @return Object - * @throws HibernateException - * @throws SQLException - * - * @deprecated {@link #nullSafeGet(ResultSet, String[], SharedSessionContractImplementor, Object)} - * should be used instead. - */ - @Deprecated - default Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) - throws HibernateException, SQLException { - return nullSafeGet( rs, names, (SharedSessionContractImplementor) session, owner ); - } - /** * Write an instance of the mapped class to a prepared statement. Implementors * should handle possibility of null values. A multi-column type should be written @@ -129,28 +108,6 @@ public interface UserType { */ void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException; - /** - * Write an instance of the mapped class to a prepared statement. Implementors - * should handle possibility of null values. A multi-column type should be written - * to parameters starting from index. - * - * - * @param st a JDBC prepared statement - * @param value the object to write - * @param index statement parameter index - * @param session - * @throws HibernateException - * @throws SQLException - * - * @deprecated {@link #nullSafeSet(PreparedStatement, Object, int, SharedSessionContractImplementor)} - * should be used instead. - */ - @Deprecated - default void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) - throws HibernateException, SQLException { - nullSafeSet( st, value, index, (SharedSessionContractImplementor) session ); - } - /** * Return a deep copy of the persistent state, stopping at entities and at * collections. It is not necessary to copy immutable objects, or null diff --git a/hibernate-core/src/main/java/org/hibernate/usertype/UserVersionType.java b/hibernate-core/src/main/java/org/hibernate/usertype/UserVersionType.java index daa7425c2c..abd55a59ef 100755 --- a/hibernate-core/src/main/java/org/hibernate/usertype/UserVersionType.java +++ b/hibernate-core/src/main/java/org/hibernate/usertype/UserVersionType.java @@ -8,12 +8,11 @@ package org.hibernate.usertype; import java.util.Comparator; -import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; /** * A user type that may be used for a version property - * + * * @author Gavin King */ public interface UserVersionType extends UserType, Comparator { @@ -27,21 +26,6 @@ public interface UserVersionType extends UserType, Comparator { */ Object seed(SharedSessionContractImplementor session); - /** - * Generate an initial version. - * - * @param session The session from which this request originates. May be - * null; currently this only happens during startup when trying to determine - * the "unsaved value" of entities. - * @return an instance of the type - * - * @deprecated {@link #seed(SharedSessionContractImplementor)} should be used instead. - */ - @Deprecated - default Object seed(SessionImplementor session) { - return seed( (SharedSessionContractImplementor) session ); - } - /** * Increment the version. * @@ -50,19 +34,4 @@ public interface UserVersionType extends UserType, Comparator { * @return an instance of the type */ Object next(Object current, SharedSessionContractImplementor session); - - /** - * Increment the version. - * - * @param session The session from which this request originates. - * @param current the current version - * @return an instance of the type - * - * @deprecated {@link #next(Object, SharedSessionContractImplementor)} should be used instead. - */ - @Deprecated - default Object next(Object current, SessionImplementor session) { - return next( current, (SharedSessionContractImplementor) session ); - } - }