Added a method for removing DdlTypes from the DdlTypeRegistry (intended for internal use)

Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
Jan Schatteman 2022-06-09 19:07:53 +02:00 committed by Jan Schatteman
parent b2fe35c297
commit e26237dc0b
1 changed files with 12 additions and 1 deletions

View File

@ -13,11 +13,11 @@ import java.util.Map;
import java.util.TreeMap;
import org.hibernate.HibernateException;
import org.hibernate.Internal;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.jdbc.Size;
import org.hibernate.type.SqlTypes;
import org.hibernate.type.descriptor.JdbcTypeNameMapper;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.sql.DdlType;
import org.hibernate.type.spi.TypeConfiguration;
@ -78,6 +78,17 @@ public class DdlTypeRegistry implements Serializable {
}
}
@Internal
public void removeDescriptor(int sqlTypeCode) {
final DdlType removable = ddlTypes.get( sqlTypeCode );
if ( removable != null ) {
for ( String rawTypeName : removable.getRawTypeNames() ) {
sqlTypes.remove( rawTypeName );
}
log.debugf( "removeDescriptor(%d) removed registration(%s)", sqlTypeCode, removable );
}
}
/**
* Returns the {@link SqlTypes} type code for the given DDL raw type name, or <code>null</code> if it is unknown.
*/