mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-17 16:44:57 +00:00
HHH-13494 Deprecate singleton access in favour of static helpers
This commit is contained in:
parent
cd3b76960e
commit
3088a2cfd0
@ -597,8 +597,8 @@ public org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry getJava
|
||||
);
|
||||
int jdbcTypeCode = recommendedSqlType.getSqlType();
|
||||
if ( isLob() ) {
|
||||
if ( LobTypeMappings.INSTANCE.hasCorrespondingLobCode( jdbcTypeCode ) ) {
|
||||
jdbcTypeCode = LobTypeMappings.INSTANCE.getCorrespondingLobCode( jdbcTypeCode );
|
||||
if ( LobTypeMappings.isMappedToKnownLobCode( jdbcTypeCode ) ) {
|
||||
jdbcTypeCode = LobTypeMappings.getLobCodeTypeMapping( jdbcTypeCode );
|
||||
}
|
||||
else {
|
||||
if ( Serializable.class.isAssignableFrom( entityAttributeJavaTypeDescriptor.getJavaType() ) ) {
|
||||
|
@ -16,17 +16,41 @@
|
||||
* @author Steve Ebersole
|
||||
* @author Sanne Grinovero
|
||||
*/
|
||||
public class LobTypeMappings {
|
||||
public final class LobTypeMappings {
|
||||
|
||||
/**
|
||||
* Singleton access
|
||||
* @deprecated use the static method helpers instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final LobTypeMappings INSTANCE = new LobTypeMappings();
|
||||
|
||||
private LobTypeMappings() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param jdbcTypeCode
|
||||
* @return
|
||||
* @deprecated use {@link #isMappedToKnownLobCode(int)}
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean hasCorrespondingLobCode(final int jdbcTypeCode) {
|
||||
return isMappedToKnownLobCode( jdbcTypeCode );
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param jdbcTypeCode
|
||||
* @return
|
||||
* @deprecated use {@link #getLobCodeTypeMapping(int)}
|
||||
*/
|
||||
@Deprecated
|
||||
public int getCorrespondingLobCode(final int jdbcTypeCode) {
|
||||
return getLobCodeTypeMapping( jdbcTypeCode );
|
||||
}
|
||||
|
||||
public static boolean isMappedToKnownLobCode(final int jdbcTypeCode) {
|
||||
return
|
||||
// BLOB mappings
|
||||
jdbcTypeCode == Types.BLOB ||
|
||||
@ -47,7 +71,7 @@ public boolean hasCorrespondingLobCode(final int jdbcTypeCode) {
|
||||
jdbcTypeCode == Types.LONGNVARCHAR;
|
||||
}
|
||||
|
||||
public int getCorrespondingLobCode(final int jdbcTypeCode) {
|
||||
public static int getLobCodeTypeMapping(final int jdbcTypeCode) {
|
||||
switch ( jdbcTypeCode ) {
|
||||
|
||||
// BLOB mappings
|
||||
@ -71,12 +95,12 @@ public int getCorrespondingLobCode(final int jdbcTypeCode) {
|
||||
// Anything else:
|
||||
default:
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
Locale.ROOT,
|
||||
"JDBC type-code [%s (%s)] not known to have a corresponding LOB equivalent",
|
||||
jdbcTypeCode,
|
||||
JdbcTypeNameMapper.getTypeName( jdbcTypeCode )
|
||||
) );
|
||||
String.format(
|
||||
Locale.ROOT,
|
||||
"JDBC type-code [%s (%s)] not known to have a corresponding LOB equivalent",
|
||||
jdbcTypeCode,
|
||||
JdbcTypeNameMapper.getTypeName( jdbcTypeCode )
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user