Package org.hibernate.dialect
Interface DatabaseVersion
- All Known Subinterfaces:
DialectResolutionInfo
- All Known Implementing Classes:
DatabaseMetaDataDialectResolutionInfoAdapter
,SimpleDatabaseVersion
public interface DatabaseVersion
Details about the underlying database, as understood by a Dialect.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Constant used to indicate that no version is defined -
Method Summary
Modifier and TypeMethodDescriptionint
Obtain access to the database major version, as returned fromDatabaseMetaData.getDatabaseMajorVersion()
for the target database.default int
Obtain access to the database minor version, as returned fromDatabaseMetaData.getDatabaseMinorVersion()
for the target database.int
Obtain access to the database minor version, as returned fromDatabaseMetaData.getDatabaseMinorVersion()
for the target database.default int
getMajor()
Simpler namingdefault int
getMicro()
Simpler namingdefault int
getMinor()
Simpler namingdefault boolean
isAfter
(int major) Determine whether this version after the passed onedefault boolean
isAfter
(int major, int minor) Determine whether this version after the passed onedefault boolean
isAfter
(int otherMajor, int otherMinor, int otherMicro) Determine whether this version after the passed onedefault boolean
Determine whether this version after the passed onedefault boolean
isAfter
(DatabaseVersion other) Determine whether this version comes after the passed onedefault boolean
isBefore
(int major) Determine whether this version before the passed onedefault boolean
isBefore
(int major, int minor) Determine whether this version before the passed onedefault boolean
isBefore
(int otherMajor, int otherMinor, int otherMicro) Determine whether this version before the passed onedefault boolean
Determine whether this version before the passed onedefault boolean
isBefore
(DatabaseVersion other) Determine whether this version comes before the passed onedefault boolean
isSame
(int otherMajor) Determine if this version matches the passed one.default boolean
isSame
(int otherMajor, int otherMinor) Determine if this version matches the passed one.default boolean
isSame
(int otherMajor, int otherMinor, int otherMicro) Determine if this version matches the passed one.default boolean
isSame
(DatabaseVersion other) Determine if the versions are the same/equal.default boolean
isSameOrAfter
(int otherMajor) default boolean
isSameOrAfter
(int otherMajor, int otherMinor) default boolean
isSameOrAfter
(int otherMajor, int otherMinor, int otherMicro) default boolean
isSameOrAfter
(Integer otherMajor, Integer otherMinor) default boolean
isSameOrAfter
(DatabaseVersion other) static DatabaseVersion
Factory for DatabaseVersion based on major version (minor and micro set to zero)static DatabaseVersion
Factory for DatabaseVersion based on major and minor version (micro set to zero)static DatabaseVersion
Factory for DatabaseVersion based on major, minor and microdefault DatabaseVersion
makeCopy()
Deprecated.default DatabaseVersion
makeCopy
(boolean noVersionAsZero) Deprecated.In dialect implementations, prefermakeCopyOrDefault(DatabaseVersion)
to gracefully default to the minimum supported version.default DatabaseVersion
makeCopyOrDefault
(DatabaseVersion defaultVersion) Make a simple copy of this version object, unless this version object hasno version information
, in which case just return the givendefaultVersion
.
-
Field Details
-
NO_VERSION
static final int NO_VERSIONConstant used to indicate that no version is defined- See Also:
-
-
Method Details
-
make
Factory for DatabaseVersion based on major version (minor and micro set to zero) -
make
Factory for DatabaseVersion based on major and minor version (micro set to zero) -
make
Factory for DatabaseVersion based on major, minor and micro -
getDatabaseMajorVersion
int getDatabaseMajorVersion()Obtain access to the database major version, as returned fromDatabaseMetaData.getDatabaseMajorVersion()
for the target database.- Returns:
- The database major version, or -9999 to indicate "no version information"
- See Also:
-
getDatabaseMinorVersion
int getDatabaseMinorVersion()Obtain access to the database minor version, as returned fromDatabaseMetaData.getDatabaseMinorVersion()
for the target database.- Returns:
- The database minor version, or -9999 to indicate "no version information"
- See Also:
-
getDatabaseMicroVersion
default int getDatabaseMicroVersion()Obtain access to the database minor version, as returned fromDatabaseMetaData.getDatabaseMinorVersion()
for the target database.- Returns:
- The database minor version, or -9999 to indicate "no version information"
- See Also:
-
getMajor
default int getMajor()Simpler naming- See Also:
-
getMinor
default int getMinor()Simpler naming- See Also:
-
getMicro
default int getMicro()Simpler naming- See Also:
-
makeCopyOrDefault
Make a simple copy of this version object, unless this version object hasno version information
, in which case just return the givendefaultVersion
.- Parameters:
defaultVersion
- The default version, to be returned if this version object hasno version information
.- Returns:
- The copy, or
defaultVersion
.
-
makeCopy
Deprecated.In dialect implementations, prefermakeCopyOrDefault(DatabaseVersion)
to gracefully default to the minimum supported version.Make a simple copy of this version object -
makeCopy
Deprecated.In dialect implementations, prefermakeCopyOrDefault(DatabaseVersion)
to gracefully default to the minimum supported version.Make a copy of this version object, possibly convertingNO_VERSION
to zero -
isSame
Determine if the versions are the same/equal. -
isSame
default boolean isSame(int otherMajor) Determine if this version matches the passed one. -
isSame
default boolean isSame(int otherMajor, int otherMinor) Determine if this version matches the passed one. -
isSame
default boolean isSame(int otherMajor, int otherMinor, int otherMicro) Determine if this version matches the passed one. -
isSameOrAfter
-
isSameOrAfter
-
isSameOrAfter
default boolean isSameOrAfter(int otherMajor) -
isSameOrAfter
default boolean isSameOrAfter(int otherMajor, int otherMinor) -
isSameOrAfter
default boolean isSameOrAfter(int otherMajor, int otherMinor, int otherMicro) -
isAfter
Determine whether this version comes after the passed one -
isAfter
Determine whether this version after the passed one -
isAfter
default boolean isAfter(int major) Determine whether this version after the passed one -
isAfter
default boolean isAfter(int major, int minor) Determine whether this version after the passed one -
isAfter
default boolean isAfter(int otherMajor, int otherMinor, int otherMicro) Determine whether this version after the passed one -
isBefore
Determine whether this version comes before the passed one -
isBefore
default boolean isBefore(int major, int minor) Determine whether this version before the passed one -
isBefore
default boolean isBefore(int major) Determine whether this version before the passed one -
isBefore
Determine whether this version before the passed one -
isBefore
default boolean isBefore(int otherMajor, int otherMinor, int otherMicro) Determine whether this version before the passed one
-
makeCopyOrDefault(DatabaseVersion)
to gracefully default to the minimum supported version.