add some cross-refs to the Javadoc

so we can easily find where these settings ultimately come from
This commit is contained in:
Gavin 2022-11-13 10:09:52 +01:00 committed by Gavin King
parent f58e450ea8
commit cf9578a9e0
4 changed files with 57 additions and 18 deletions

View File

@ -11,7 +11,7 @@ import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
/** /**
* Contract for binding values to a {@link PreparedStatement}. * Contract for binding values to a JDBC {@link PreparedStatement}.
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */

View File

@ -11,8 +11,8 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
/** /**
* Contract for extracting value via JDBC from {@link ResultSet} or as output * Contract for extracting values from a JDBC {@link ResultSet} or
* param from {@link CallableStatement}. * from output the parameters of a {@link CallableStatement}.
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */

View File

@ -6,57 +6,82 @@
*/ */
package org.hibernate.type.descriptor; package org.hibernate.type.descriptor;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.TimeZone;
import org.hibernate.engine.jdbc.LobCreator; import org.hibernate.engine.jdbc.LobCreator;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import java.util.TimeZone;
/** /**
* Gives binding (nullSafeSet) and extracting (nullSafeGet) code access to options. * Options for {@linkplain ValueBinder#bind(java.sql.PreparedStatement, Object, int, WrapperOptions)
* binding values to} and {@linkplain ValueExtractor#extract(java.sql.ResultSet, int, WrapperOptions)
* extracting values from} JDBC prepared statements and result sets.
* *
* @author Steve Ebersole * @author Steve Ebersole
*
* @see ValueBinder
* @see ValueExtractor
*/ */
public interface WrapperOptions { public interface WrapperOptions {
/** /**
* Access to the current Session * Access to the current session.
*/ */
SharedSessionContractImplementor getSession(); SharedSessionContractImplementor getSession();
/** /**
* Access to the current Session * Access to the current session factory.
*/ */
SessionFactoryImplementor getSessionFactory(); SessionFactoryImplementor getSessionFactory();
/** /**
* Should streams be used for binding LOB values. * Determines whether streams should be used for binding LOB values.
* *
* @return {@code true}/{@code false} * @return {@code true}/{@code false}
*
* @see org.hibernate.dialect.Dialect#useInputStreamToInsertBlob()
*/ */
boolean useStreamForLobBinding(); boolean useStreamForLobBinding();
/** /**
* Get the JDBC {@link java.sql.Types type code} used to bind a null boolean value * The JDBC {@link java.sql.Types type code} used to bind a null boolean value.
*
* @see org.hibernate.cfg.AvailableSettings#PREFERRED_BOOLEAN_JDBC_TYPE
* @see org.hibernate.dialect.Dialect#getPreferredSqlTypeCodeForBoolean()
*/ */
int getPreferredSqlTypeCodeForBoolean(); int getPreferredSqlTypeCodeForBoolean();
/** /**
* Obtain access to the {@link LobCreator} * Obtain access to the {@link LobCreator}.
* *
* @return The LOB creator * @return The LOB creator
*
* @see org.hibernate.cfg.AvailableSettings#NON_CONTEXTUAL_LOB_CREATION
* @see org.hibernate.dialect.Dialect#getDefaultNonContextualLobCreation()
*/ */
LobCreator getLobCreator(); LobCreator getLobCreator();
/** /**
* The JDBC {@link TimeZone} used when persisting Timestamp and DateTime properties into the database. * The JDBC {@link TimeZone} used when writing a value of type {@link java.sql.Time}
* This setting is used when storing timestamps using the {@link java.sql.PreparedStatement#setTimestamp(int, Timestamp, Calendar)} method. * or {@link java.sql.Timestamp} to a JDBC {@link java.sql.PreparedStatement}, or
* when reading from a JDBC {@link java.sql.ResultSet}.
* <ul>
* <li>When {@code getJdbcTimeZone()} is null, the method
* {@link java.sql.PreparedStatement#setTimestamp(int, java.sql.Timestamp)} is
* called to write a timestamp, and
* {@link java.sql.ResultSet#getTimestamp(int)} is called to read a timestamp.
* <li>But when not null, the method
* {@link java.sql.PreparedStatement#setTimestamp(int, java.sql.Timestamp, java.util.Calendar)}
* is called to write a timestamp, and
* {@link java.sql.ResultSet#getTimestamp(int, java.util.Calendar)} is called to
* read a timestamp.
</ul>
* Thus, the storage {@link TimeZone} can differ from the default JVM TimeZone given
* by {@link TimeZone#getDefault()}.
* *
* This way, the storage {@link TimeZone} can differ from the default JVM TimeZone given by {@link TimeZone#getDefault()}. * @return the JDBC {@link TimeZone}, or null if no JDBC timezone was explicitly set
* *
* @return JDBC {@link TimeZone} * @see org.hibernate.cfg.AvailableSettings#JDBC_TIME_ZONE
*/ */
TimeZone getJdbcTimeZone(); TimeZone getJdbcTimeZone();
} }

View File

@ -15,7 +15,7 @@ import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
/** /**
* A parameter object that helps in determine the {@link java.sql.Types SQL/JDBC type} * A parameter object that helps determine the {@link java.sql.Types SQL/JDBC type}
* recommended by the JDBC spec (explicitly or implicitly) for a given Java type. * recommended by the JDBC spec (explicitly or implicitly) for a given Java type.
* *
* @see BasicJavaType#getRecommendedJdbcType * @see BasicJavaType#getRecommendedJdbcType
@ -67,6 +67,9 @@ public interface JdbcTypeIndicators {
* When mapping a boolean type to the database what is the preferred SQL type code to use? * When mapping a boolean type to the database what is the preferred SQL type code to use?
* <p/> * <p/>
* Returns a key into the {@link JdbcTypeRegistry}. * Returns a key into the {@link JdbcTypeRegistry}.
*
* @see org.hibernate.cfg.AvailableSettings#PREFERRED_BOOLEAN_JDBC_TYPE
* @see org.hibernate.dialect.Dialect#getPreferredSqlTypeCodeForBoolean()
*/ */
default int getPreferredSqlTypeCodeForBoolean() { default int getPreferredSqlTypeCodeForBoolean() {
return getCurrentBaseSqlTypeIndicators().getPreferredSqlTypeCodeForBoolean(); return getCurrentBaseSqlTypeIndicators().getPreferredSqlTypeCodeForBoolean();
@ -76,6 +79,8 @@ public interface JdbcTypeIndicators {
* When mapping a duration type to the database what is the preferred SQL type code to use? * When mapping a duration type to the database what is the preferred SQL type code to use?
* <p/> * <p/>
* Returns a key into the {@link JdbcTypeRegistry}. * Returns a key into the {@link JdbcTypeRegistry}.
*
* @see org.hibernate.cfg.AvailableSettings#PREFERRED_DURATION_JDBC_TYPE
*/ */
default int getPreferredSqlTypeCodeForDuration() { default int getPreferredSqlTypeCodeForDuration() {
return getCurrentBaseSqlTypeIndicators().getPreferredSqlTypeCodeForDuration(); return getCurrentBaseSqlTypeIndicators().getPreferredSqlTypeCodeForDuration();
@ -85,6 +90,8 @@ public interface JdbcTypeIndicators {
* When mapping an uuid type to the database what is the preferred SQL type code to use? * When mapping an uuid type to the database what is the preferred SQL type code to use?
* <p/> * <p/>
* Returns a key into the {@link JdbcTypeRegistry}. * Returns a key into the {@link JdbcTypeRegistry}.
*
* @see org.hibernate.cfg.AvailableSettings#PREFERRED_UUID_JDBC_TYPE
*/ */
default int getPreferredSqlTypeCodeForUuid() { default int getPreferredSqlTypeCodeForUuid() {
return getCurrentBaseSqlTypeIndicators().getPreferredSqlTypeCodeForUuid(); return getCurrentBaseSqlTypeIndicators().getPreferredSqlTypeCodeForUuid();
@ -94,6 +101,8 @@ public interface JdbcTypeIndicators {
* When mapping an instant type to the database what is the preferred SQL type code to use? * When mapping an instant type to the database what is the preferred SQL type code to use?
* <p/> * <p/>
* Returns a key into the {@link JdbcTypeRegistry}. * Returns a key into the {@link JdbcTypeRegistry}.
*
* @see org.hibernate.cfg.AvailableSettings#PREFERRED_INSTANT_JDBC_TYPE
*/ */
default int getPreferredSqlTypeCodeForInstant() { default int getPreferredSqlTypeCodeForInstant() {
return getCurrentBaseSqlTypeIndicators().getPreferredSqlTypeCodeForInstant(); return getCurrentBaseSqlTypeIndicators().getPreferredSqlTypeCodeForInstant();
@ -104,6 +113,8 @@ public interface JdbcTypeIndicators {
* <p/> * <p/>
* Returns a key into the {@link JdbcTypeRegistry}. * Returns a key into the {@link JdbcTypeRegistry}.
* *
* @see org.hibernate.dialect.Dialect#getPreferredSqlTypeCodeForArray()
*
* @since 6.1 * @since 6.1
*/ */
default int getPreferredSqlTypeCodeForArray() { default int getPreferredSqlTypeCodeForArray() {
@ -137,6 +148,9 @@ public interface JdbcTypeIndicators {
/** /**
* The default {@link TimeZoneStorageStrategy}. * The default {@link TimeZoneStorageStrategy}.
*
* @see org.hibernate.cfg.AvailableSettings#TIMEZONE_DEFAULT_STORAGE
* @see org.hibernate.dialect.Dialect#getTimeZoneSupport()
*/ */
default TimeZoneStorageStrategy getDefaultTimeZoneStorageStrategy() { default TimeZoneStorageStrategy getDefaultTimeZoneStorageStrategy() {
return getCurrentBaseSqlTypeIndicators().getDefaultTimeZoneStorageStrategy(); return getCurrentBaseSqlTypeIndicators().getDefaultTimeZoneStorageStrategy();