parent
424460af3f
commit
26cd62ff6d
|
@ -1,40 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
|
||||||
*/
|
|
||||||
package org.hibernate.boot.model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An enumeration of truth values.
|
|
||||||
*
|
|
||||||
* @implNote Sure, this could be handled with {@code Boolean}, but
|
|
||||||
* that option is vulnerable to unwanted auto-unboxing
|
|
||||||
* and {@link NullPointerException}s.
|
|
||||||
*
|
|
||||||
* @author Steve Ebersole
|
|
||||||
*/
|
|
||||||
public enum TruthValue {
|
|
||||||
TRUE,
|
|
||||||
FALSE,
|
|
||||||
UNKNOWN;
|
|
||||||
|
|
||||||
public static TruthValue of(boolean bool) {
|
|
||||||
return bool ? TRUE : FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean toBoolean(boolean defaultValue) {
|
|
||||||
return switch ( this ) {
|
|
||||||
case TRUE -> true;
|
|
||||||
case FALSE -> false;
|
|
||||||
default -> defaultValue;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated No longer used
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "7", forRemoval = true)
|
|
||||||
public static boolean toBoolean(TruthValue value, boolean defaultValue) {
|
|
||||||
return value != null ? value.toBoolean( defaultValue ) : defaultValue;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -22,7 +22,6 @@ import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmRootEntityType;
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSecondaryTableType;
|
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSecondaryTableType;
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.SecondaryTableContainer;
|
import org.hibernate.boot.jaxb.hbm.spi.SecondaryTableContainer;
|
||||||
import org.hibernate.boot.model.CustomSql;
|
import org.hibernate.boot.model.CustomSql;
|
||||||
import org.hibernate.boot.model.TruthValue;
|
|
||||||
import org.hibernate.boot.model.source.spi.AttributePath;
|
import org.hibernate.boot.model.source.spi.AttributePath;
|
||||||
import org.hibernate.boot.model.source.spi.AttributeRole;
|
import org.hibernate.boot.model.source.spi.AttributeRole;
|
||||||
import org.hibernate.boot.model.source.spi.AttributeSource;
|
import org.hibernate.boot.model.source.spi.AttributeSource;
|
||||||
|
@ -391,10 +390,4 @@ public abstract class AbstractEntitySourceImpl
|
||||||
return jaxbEntityMapping.getSqlQuery();
|
return jaxbEntityMapping.getSqlQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TruthValue quoteIdentifiersLocalToEntity() {
|
|
||||||
// HBM does not allow for this
|
|
||||||
return TruthValue.UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ package org.hibernate.boot.model.source.internal.hbm;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.boot.model.TruthValue;
|
|
||||||
import org.hibernate.boot.model.source.spi.ColumnSource;
|
import org.hibernate.boot.model.source.spi.ColumnSource;
|
||||||
import org.hibernate.boot.model.source.spi.JdbcDataType;
|
import org.hibernate.boot.model.source.spi.JdbcDataType;
|
||||||
import org.hibernate.boot.model.source.spi.SizeSource;
|
import org.hibernate.boot.model.source.spi.SizeSource;
|
||||||
|
@ -24,8 +23,8 @@ class ColumnAttributeSourceImpl
|
||||||
private final String tableName;
|
private final String tableName;
|
||||||
private final String columnName;
|
private final String columnName;
|
||||||
private final SizeSource sizeSource;
|
private final SizeSource sizeSource;
|
||||||
private final TruthValue nullable;
|
private final Boolean nullable;
|
||||||
private final TruthValue unique;
|
private final Boolean unique;
|
||||||
private final Set<String> indexConstraintNames;
|
private final Set<String> indexConstraintNames;
|
||||||
private final Set<String> ukConstraintNames;
|
private final Set<String> ukConstraintNames;
|
||||||
|
|
||||||
|
@ -34,8 +33,8 @@ class ColumnAttributeSourceImpl
|
||||||
String tableName,
|
String tableName,
|
||||||
String columnName,
|
String columnName,
|
||||||
SizeSource sizeSource,
|
SizeSource sizeSource,
|
||||||
TruthValue nullable,
|
Boolean nullable,
|
||||||
TruthValue unique,
|
Boolean unique,
|
||||||
Set<String> indexConstraintNames,
|
Set<String> indexConstraintNames,
|
||||||
Set<String> ukConstraintNames) {
|
Set<String> ukConstraintNames) {
|
||||||
super( mappingDocument );
|
super( mappingDocument );
|
||||||
|
@ -64,7 +63,7 @@ class ColumnAttributeSourceImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TruthValue isNullable() {
|
public Boolean isNullable() {
|
||||||
return nullable;
|
return nullable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +99,7 @@ class ColumnAttributeSourceImpl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isUnique() {
|
public boolean isUnique() {
|
||||||
return unique == TruthValue.TRUE;
|
return unique == Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,16 +5,15 @@
|
||||||
package org.hibernate.boot.model.source.internal.hbm;
|
package org.hibernate.boot.model.source.internal.hbm;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmColumnType;
|
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmColumnType;
|
||||||
import org.hibernate.boot.model.TruthValue;
|
|
||||||
import org.hibernate.boot.model.source.spi.ColumnSource;
|
import org.hibernate.boot.model.source.spi.ColumnSource;
|
||||||
import org.hibernate.boot.model.source.spi.JdbcDataType;
|
import org.hibernate.boot.model.source.spi.JdbcDataType;
|
||||||
import org.hibernate.boot.model.source.spi.SizeSource;
|
import org.hibernate.boot.model.source.spi.SizeSource;
|
||||||
|
|
||||||
|
import static java.util.Collections.addAll;
|
||||||
import static org.hibernate.internal.util.StringHelper.splitAtCommas;
|
import static org.hibernate.internal.util.StringHelper.splitAtCommas;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,7 +24,7 @@ class ColumnSourceImpl
|
||||||
implements ColumnSource {
|
implements ColumnSource {
|
||||||
private final String tableName;
|
private final String tableName;
|
||||||
private final JaxbHbmColumnType columnElement;
|
private final JaxbHbmColumnType columnElement;
|
||||||
private final TruthValue nullable;
|
private final Boolean nullable;
|
||||||
private final Set<String> indexConstraintNames;
|
private final Set<String> indexConstraintNames;
|
||||||
private final Set<String> ukConstraintNames;
|
private final Set<String> ukConstraintNames;
|
||||||
|
|
||||||
|
@ -39,27 +38,19 @@ class ColumnSourceImpl
|
||||||
mappingDocument,
|
mappingDocument,
|
||||||
tableName,
|
tableName,
|
||||||
columnElement,
|
columnElement,
|
||||||
interpretNotNullToNullability( columnElement.isNotNull() ),
|
columnElement.isNotNull() == null
|
||||||
|
? null
|
||||||
|
: !columnElement.isNotNull(),
|
||||||
indexConstraintNames,
|
indexConstraintNames,
|
||||||
ukConstraintNames
|
ukConstraintNames
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TruthValue interpretNotNullToNullability(Boolean notNull) {
|
|
||||||
if ( notNull == null ) {
|
|
||||||
return TruthValue.UNKNOWN;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// not-null == nullable, so the booleans are reversed
|
|
||||||
return notNull ? TruthValue.FALSE : TruthValue.TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnSourceImpl(
|
ColumnSourceImpl(
|
||||||
MappingDocument mappingDocument,
|
MappingDocument mappingDocument,
|
||||||
String tableName,
|
String tableName,
|
||||||
JaxbHbmColumnType columnElement,
|
JaxbHbmColumnType columnElement,
|
||||||
TruthValue nullable,
|
Boolean nullable,
|
||||||
Set<String> indexConstraintNames,
|
Set<String> indexConstraintNames,
|
||||||
Set<String> ukConstraintNames) {
|
Set<String> ukConstraintNames) {
|
||||||
super( mappingDocument );
|
super( mappingDocument );
|
||||||
|
@ -86,7 +77,7 @@ class ColumnSourceImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TruthValue isNullable() {
|
public Boolean isNullable() {
|
||||||
return nullable;
|
return nullable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,8 +117,8 @@ class ColumnSourceImpl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isUnique() {
|
public boolean isUnique() {
|
||||||
// TODO: should TruthValue be returned instead of boolean?
|
return columnElement.isUnique() != null
|
||||||
return columnElement.isUnique() != null && columnElement.isUnique().booleanValue();
|
&& columnElement.isUnique();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -160,8 +151,8 @@ class ColumnSourceImpl
|
||||||
return stringSet;
|
return stringSet;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
HashSet<String> set = new HashSet<>( stringSet );
|
final HashSet<String> set = new HashSet<>( stringSet );
|
||||||
Collections.addAll( set, splitAtCommas( values ) );
|
addAll( set, splitAtCommas( values ) );
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.hibernate.boot.model.source.internal.hbm;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.boot.model.TruthValue;
|
|
||||||
import org.hibernate.boot.model.naming.Identifier;
|
import org.hibernate.boot.model.naming.Identifier;
|
||||||
import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
|
import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
|
||||||
import org.hibernate.boot.model.relational.Database;
|
import org.hibernate.boot.model.relational.Database;
|
||||||
|
@ -150,7 +149,8 @@ public class RelationalObjectBinder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
column.setNullable( interpretNullability( columnSource.isNullable(), areColumnsNullableByDefault ) );
|
final Boolean nullable = columnSource.isNullable();
|
||||||
|
column.setNullable( nullable == null ? areColumnsNullableByDefault : nullable );
|
||||||
|
|
||||||
column.setUnique( columnSource.isUnique() );
|
column.setUnique( columnSource.isUnique() );
|
||||||
if ( columnSource.isUnique() && table != null ) {
|
if ( columnSource.isUnique() && table != null ) {
|
||||||
|
@ -182,15 +182,6 @@ public class RelationalObjectBinder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean interpretNullability(TruthValue nullable, boolean areColumnsNullableByDefault) {
|
|
||||||
if ( nullable == null || nullable == TruthValue.UNKNOWN ) {
|
|
||||||
return areColumnsNullableByDefault;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nullable == TruthValue.TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void bindFormulas(
|
public void bindFormulas(
|
||||||
MappingDocument sourceDocument,
|
MappingDocument sourceDocument,
|
||||||
List<DerivedValueSource> formulaSources,
|
List<DerivedValueSource> formulaSources,
|
||||||
|
|
|
@ -12,14 +12,14 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.boot.MappingException;
|
import org.hibernate.boot.MappingException;
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmColumnType;
|
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmColumnType;
|
||||||
import org.hibernate.boot.model.TruthValue;
|
|
||||||
import org.hibernate.boot.model.source.spi.ColumnSource;
|
import org.hibernate.boot.model.source.spi.ColumnSource;
|
||||||
import org.hibernate.boot.model.source.spi.DerivedValueSource;
|
import org.hibernate.boot.model.source.spi.DerivedValueSource;
|
||||||
import org.hibernate.boot.model.source.spi.RelationalValueSource;
|
import org.hibernate.boot.model.source.spi.RelationalValueSource;
|
||||||
import org.hibernate.boot.model.source.spi.SizeSource;
|
import org.hibernate.boot.model.source.spi.SizeSource;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
|
||||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||||
|
|
||||||
|
import static org.hibernate.internal.util.StringHelper.isNotEmpty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@ -152,7 +152,7 @@ public class RelationalValueSourceHelper {
|
||||||
if ( sources.size() > 1 ) {
|
if ( sources.size() > 1 ) {
|
||||||
final String errorMessage;
|
final String errorMessage;
|
||||||
if ( columnsAndFormulasSource.getSourceType().canBeNamed()
|
if ( columnsAndFormulasSource.getSourceType().canBeNamed()
|
||||||
&& StringHelper.isNotEmpty( columnsAndFormulasSource.getSourceName() ) ) {
|
&& isNotEmpty( columnsAndFormulasSource.getSourceName() ) ) {
|
||||||
errorMessage = String.format(
|
errorMessage = String.format(
|
||||||
Locale.ENGLISH,
|
Locale.ENGLISH,
|
||||||
"Expecting just a single formula/column in context of <%s name=\"%s\"/>",
|
"Expecting just a single formula/column in context of <%s name=\"%s\"/>",
|
||||||
|
@ -197,7 +197,7 @@ public class RelationalValueSourceHelper {
|
||||||
if ( sources.size() > 1 ) {
|
if ( sources.size() > 1 ) {
|
||||||
final String errorMessage;
|
final String errorMessage;
|
||||||
if ( columnsAndFormulasSource.getSourceType().canBeNamed()
|
if ( columnsAndFormulasSource.getSourceType().canBeNamed()
|
||||||
&& StringHelper.isNotEmpty( columnsAndFormulasSource.getSourceName() ) ) {
|
&& isNotEmpty( columnsAndFormulasSource.getSourceName() ) ) {
|
||||||
errorMessage = String.format(
|
errorMessage = String.format(
|
||||||
Locale.ENGLISH,
|
Locale.ENGLISH,
|
||||||
"Expecting just a single formula/column in context of <%s name=\"%s\"/>",
|
"Expecting just a single formula/column in context of <%s name=\"%s\"/>",
|
||||||
|
@ -219,7 +219,7 @@ public class RelationalValueSourceHelper {
|
||||||
if ( !(result instanceof ColumnSource) ) {
|
if ( !(result instanceof ColumnSource) ) {
|
||||||
final String errorMessage;
|
final String errorMessage;
|
||||||
if ( columnsAndFormulasSource.getSourceType().canBeNamed()
|
if ( columnsAndFormulasSource.getSourceType().canBeNamed()
|
||||||
&& StringHelper.isNotEmpty( columnsAndFormulasSource.getSourceName() ) ) {
|
&& isNotEmpty( columnsAndFormulasSource.getSourceName() ) ) {
|
||||||
errorMessage = String.format(
|
errorMessage = String.format(
|
||||||
Locale.ENGLISH,
|
Locale.ENGLISH,
|
||||||
"Expecting single column in context of <%s name=\"%s\"/>, but found formula [%s]",
|
"Expecting single column in context of <%s name=\"%s\"/>, but found formula [%s]",
|
||||||
|
@ -267,7 +267,7 @@ public class RelationalValueSourceHelper {
|
||||||
if ( !(source instanceof ColumnSource) ) {
|
if ( !(source instanceof ColumnSource) ) {
|
||||||
final String errorMessage;
|
final String errorMessage;
|
||||||
if ( columnsAndFormulasSource.getSourceType().canBeNamed()
|
if ( columnsAndFormulasSource.getSourceType().canBeNamed()
|
||||||
&& StringHelper.isNotEmpty( columnsAndFormulasSource.getSourceName() ) ) {
|
&& isNotEmpty( columnsAndFormulasSource.getSourceName() ) ) {
|
||||||
errorMessage = String.format(
|
errorMessage = String.format(
|
||||||
Locale.ENGLISH,
|
Locale.ENGLISH,
|
||||||
"Expecting only columns in context of <%s name=\"%s\"/>, but found formula [%s]",
|
"Expecting only columns in context of <%s name=\"%s\"/>, but found formula [%s]",
|
||||||
|
@ -307,7 +307,7 @@ public class RelationalValueSourceHelper {
|
||||||
ColumnsAndFormulasSource columnsAndFormulasSource) {
|
ColumnsAndFormulasSource columnsAndFormulasSource) {
|
||||||
List<RelationalValueSource> result = new ArrayList<>();
|
List<RelationalValueSource> result = new ArrayList<>();
|
||||||
|
|
||||||
if ( StringHelper.isNotEmpty( columnsAndFormulasSource.getFormulaAttribute() ) ) {
|
if ( isNotEmpty( columnsAndFormulasSource.getFormulaAttribute() ) ) {
|
||||||
// we have an explicit formula attribute (i.e., <SOMETHING formula="abc"/>)
|
// we have an explicit formula attribute (i.e., <SOMETHING formula="abc"/>)
|
||||||
validateUseOfFormulaAttribute( mappingDocument, columnsAndFormulasSource );
|
validateUseOfFormulaAttribute( mappingDocument, columnsAndFormulasSource );
|
||||||
|
|
||||||
|
@ -359,8 +359,8 @@ public class RelationalValueSourceHelper {
|
||||||
containingTableName,
|
containingTableName,
|
||||||
columnsAndFormulasSource.getColumnAttribute(),
|
columnsAndFormulasSource.getColumnAttribute(),
|
||||||
columnsAndFormulasSource.getSizeSource(),
|
columnsAndFormulasSource.getSizeSource(),
|
||||||
interpretNullabilityToTruthValue( columnsAndFormulasSource.isNullable() ),
|
columnsAndFormulasSource.isNullable(),
|
||||||
columnsAndFormulasSource.isUnique() ? TruthValue.TRUE : TruthValue.FALSE,
|
columnsAndFormulasSource.isUnique(),
|
||||||
columnsAndFormulasSource.getIndexConstraintNames(),
|
columnsAndFormulasSource.getIndexConstraintNames(),
|
||||||
columnsAndFormulasSource.getUniqueKeyConstraintNames()
|
columnsAndFormulasSource.getUniqueKeyConstraintNames()
|
||||||
)
|
)
|
||||||
|
@ -370,23 +370,14 @@ public class RelationalValueSourceHelper {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TruthValue interpretNullabilityToTruthValue(Boolean nullable) {
|
|
||||||
if ( nullable == null ) {
|
|
||||||
return TruthValue.UNKNOWN;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nullable ? TruthValue.TRUE : TruthValue.FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void validateUseOfFormulaAttribute(
|
private static void validateUseOfFormulaAttribute(
|
||||||
MappingDocument sourceDocument,
|
MappingDocument sourceDocument,
|
||||||
ColumnsAndFormulasSource columnsAndFormulasSource) {
|
ColumnsAndFormulasSource columnsAndFormulasSource) {
|
||||||
// 1) make sure there is no column attribute
|
// 1) make sure there is no column attribute
|
||||||
if ( StringHelper.isNotEmpty( columnsAndFormulasSource.getColumnAttribute() ) ) {
|
if ( isNotEmpty( columnsAndFormulasSource.getColumnAttribute() ) ) {
|
||||||
final String errorMessage;
|
final String errorMessage;
|
||||||
if ( columnsAndFormulasSource.getSourceType().canBeNamed()
|
if ( columnsAndFormulasSource.getSourceType().canBeNamed()
|
||||||
&& StringHelper.isNotEmpty( columnsAndFormulasSource.getSourceName() ) ) {
|
&& isNotEmpty( columnsAndFormulasSource.getSourceName() ) ) {
|
||||||
errorMessage = String.format(
|
errorMessage = String.format(
|
||||||
Locale.ENGLISH,
|
Locale.ENGLISH,
|
||||||
"column attribute and formula attribute may not be specified together near <%s name=\"%s\" column=\"%s\" formula=\"%s\" />",
|
"column attribute and formula attribute may not be specified together near <%s name=\"%s\" column=\"%s\" formula=\"%s\" />",
|
||||||
|
@ -411,7 +402,7 @@ public class RelationalValueSourceHelper {
|
||||||
if ( CollectionHelper.isNotEmpty( columnsAndFormulasSource.getColumnOrFormulaElements() ) ) {
|
if ( CollectionHelper.isNotEmpty( columnsAndFormulasSource.getColumnOrFormulaElements() ) ) {
|
||||||
final String errorMessage;
|
final String errorMessage;
|
||||||
if ( columnsAndFormulasSource.getSourceType().canBeNamed()
|
if ( columnsAndFormulasSource.getSourceType().canBeNamed()
|
||||||
&& StringHelper.isNotEmpty( columnsAndFormulasSource.getSourceName() ) ) {
|
&& isNotEmpty( columnsAndFormulasSource.getSourceName() ) ) {
|
||||||
errorMessage = String.format(
|
errorMessage = String.format(
|
||||||
Locale.ENGLISH,
|
Locale.ENGLISH,
|
||||||
"formula attribute may not be specified along with <column/> or <formula/> subelement(s) near <%s name=\"%s\" formula=\"%s\" />",
|
"formula attribute may not be specified along with <column/> or <formula/> subelement(s) near <%s name=\"%s\" formula=\"%s\" />",
|
||||||
|
@ -435,10 +426,10 @@ public class RelationalValueSourceHelper {
|
||||||
private static void validateUseOfColumnOrFormulaNestedElements(
|
private static void validateUseOfColumnOrFormulaNestedElements(
|
||||||
MappingDocument sourceDocument,
|
MappingDocument sourceDocument,
|
||||||
ColumnsAndFormulasSource columnsAndFormulasSource) {
|
ColumnsAndFormulasSource columnsAndFormulasSource) {
|
||||||
if ( StringHelper.isNotEmpty( columnsAndFormulasSource.getColumnAttribute() ) ) {
|
if ( isNotEmpty( columnsAndFormulasSource.getColumnAttribute() ) ) {
|
||||||
final String errorMessage;
|
final String errorMessage;
|
||||||
if ( columnsAndFormulasSource.getSourceType().canBeNamed()
|
if ( columnsAndFormulasSource.getSourceType().canBeNamed()
|
||||||
&& StringHelper.isNotEmpty( columnsAndFormulasSource.getSourceName() ) ) {
|
&& isNotEmpty( columnsAndFormulasSource.getSourceName() ) ) {
|
||||||
errorMessage = String.format(
|
errorMessage = String.format(
|
||||||
Locale.ENGLISH,
|
Locale.ENGLISH,
|
||||||
"column attribute may not be specified along with <column/> or <formula/> subelement(s) near <%s name=\"%s\" column=\"%s\" />",
|
"column attribute may not be specified along with <column/> or <formula/> subelement(s) near <%s name=\"%s\" column=\"%s\" />",
|
||||||
|
@ -467,7 +458,7 @@ public class RelationalValueSourceHelper {
|
||||||
if ( customWrite != null && !customWrite.matches("[^?]*\\?[^?]*") ) {
|
if ( customWrite != null && !customWrite.matches("[^?]*\\?[^?]*") ) {
|
||||||
final String errorMessage;
|
final String errorMessage;
|
||||||
if ( columnsAndFormulasSource.getSourceType().canBeNamed()
|
if ( columnsAndFormulasSource.getSourceType().canBeNamed()
|
||||||
&& StringHelper.isNotEmpty( columnsAndFormulasSource.getSourceName() ) ) {
|
&& isNotEmpty( columnsAndFormulasSource.getSourceName() ) ) {
|
||||||
errorMessage = String.format(
|
errorMessage = String.format(
|
||||||
Locale.ENGLISH,
|
Locale.ENGLISH,
|
||||||
"write expression must contain exactly one value placeholder ('?') character near <column name=\"%s\" ... write=\"%s\" /> for <%s name=\"%s\" />",
|
"write expression must contain exactly one value placeholder ('?') character near <column name=\"%s\" ... write=\"%s\" /> for <%s name=\"%s\" />",
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package org.hibernate.boot.model.source.spi;
|
package org.hibernate.boot.model.source.spi;
|
||||||
|
|
||||||
import org.hibernate.boot.CacheRegionDefinition;
|
import org.hibernate.boot.CacheRegionDefinition;
|
||||||
import org.hibernate.boot.model.TruthValue;
|
|
||||||
import org.hibernate.cache.spi.access.AccessType;
|
import org.hibernate.cache.spi.access.AccessType;
|
||||||
|
|
||||||
import static org.hibernate.internal.util.StringHelper.isEmpty;
|
import static org.hibernate.internal.util.StringHelper.isEmpty;
|
||||||
|
@ -17,25 +16,21 @@ import static org.hibernate.internal.util.StringHelper.isEmpty;
|
||||||
* @author Hardy Ferentschik
|
* @author Hardy Ferentschik
|
||||||
*/
|
*/
|
||||||
public class Caching {
|
public class Caching {
|
||||||
// NOTE : TruthValue for now because I need to look at how JPA's SharedCacheMode concept is handled
|
private Boolean requested;
|
||||||
private TruthValue requested;
|
|
||||||
private String region;
|
private String region;
|
||||||
private AccessType accessType;
|
private AccessType accessType;
|
||||||
private boolean cacheLazyProperties;
|
private boolean cacheLazyProperties;
|
||||||
|
|
||||||
public Caching() {
|
public Caching() {}
|
||||||
this.requested = TruthValue.UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Caching(String region, AccessType accessType, boolean cacheLazyProperties) {
|
public Caching(String region, AccessType accessType, boolean cacheLazyProperties) {
|
||||||
this.requested = TruthValue.UNKNOWN;
|
|
||||||
this.region = region;
|
this.region = region;
|
||||||
this.accessType = accessType;
|
this.accessType = accessType;
|
||||||
this.cacheLazyProperties = cacheLazyProperties;
|
this.cacheLazyProperties = cacheLazyProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Caching(String region, AccessType accessType, boolean cacheLazyProperties, boolean requested) {
|
public Caching(String region, AccessType accessType, boolean cacheLazyProperties, boolean requested) {
|
||||||
this.requested = TruthValue.of( requested );
|
this.requested = requested;
|
||||||
this.region = region;
|
this.region = region;
|
||||||
this.accessType = accessType;
|
this.accessType = accessType;
|
||||||
this.cacheLazyProperties = cacheLazyProperties;
|
this.cacheLazyProperties = cacheLazyProperties;
|
||||||
|
@ -66,20 +61,20 @@ public class Caching {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRequested() {
|
public boolean isRequested() {
|
||||||
return requested == TruthValue.TRUE;
|
return requested == Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRequested(boolean defaultValue) {
|
public boolean isRequested(boolean defaultValue) {
|
||||||
return requested == TruthValue.UNKNOWN ? defaultValue : isRequested();
|
return requested == null ? defaultValue : isRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRequested(boolean requested) {
|
public void setRequested(boolean requested) {
|
||||||
this.requested = TruthValue.of(requested);
|
this.requested = requested;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void overlay(CacheRegionDefinition overrides) {
|
public void overlay(CacheRegionDefinition overrides) {
|
||||||
if ( overrides != null ) {
|
if ( overrides != null ) {
|
||||||
requested = TruthValue.TRUE;
|
requested = true;
|
||||||
accessType = AccessType.fromExternalName( overrides.getUsage() );
|
accessType = AccessType.fromExternalName( overrides.getUsage() );
|
||||||
if ( isEmpty( overrides.getRegion() ) ) {
|
if ( isEmpty( overrides.getRegion() ) ) {
|
||||||
region = overrides.getRegion();
|
region = overrides.getRegion();
|
||||||
|
@ -105,5 +100,4 @@ public class Caching {
|
||||||
+ ", cacheLazyProperties=" + cacheLazyProperties
|
+ ", cacheLazyProperties=" + cacheLazyProperties
|
||||||
+ ", requested=" + requested + '}';
|
+ ", requested=" + requested + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,6 @@ package org.hibernate.boot.model.source.spi;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.boot.model.TruthValue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contract for source information pertaining to a physical column definition specific to a particular attribute
|
* Contract for source information pertaining to a physical column definition specific to a particular attribute
|
||||||
* context.
|
* context.
|
||||||
|
@ -44,7 +42,7 @@ public interface ColumnSource extends RelationalValueSource {
|
||||||
*
|
*
|
||||||
* @return {@code true} indicates it is nullable; {@code false} non-nullable.
|
* @return {@code true} indicates it is nullable; {@code false} non-nullable.
|
||||||
*/
|
*/
|
||||||
TruthValue isNullable();
|
Boolean isNullable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain a specified default value for the column
|
* Obtain a specified default value for the column
|
||||||
|
|
|
@ -10,7 +10,6 @@ import java.util.Map;
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNamedNativeQueryType;
|
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNamedNativeQueryType;
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNamedQueryType;
|
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNamedQueryType;
|
||||||
import org.hibernate.boot.model.CustomSql;
|
import org.hibernate.boot.model.CustomSql;
|
||||||
import org.hibernate.boot.model.TruthValue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contract describing source of information related to mapping an entity.
|
* Contract describing source of information related to mapping an entity.
|
||||||
|
@ -146,7 +145,4 @@ public interface EntitySource extends IdentifiableTypeSource, ToolingHintContext
|
||||||
List<JaxbHbmNamedQueryType> getNamedQueries();
|
List<JaxbHbmNamedQueryType> getNamedQueries();
|
||||||
|
|
||||||
List<JaxbHbmNamedNativeQueryType> getNamedNativeQueries();
|
List<JaxbHbmNamedNativeQueryType> getNamedNativeQueries();
|
||||||
|
|
||||||
TruthValue quoteIdentifiersLocalToEntity();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import org.hibernate.AssertionFailure;
|
||||||
import org.hibernate.Internal;
|
import org.hibernate.Internal;
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.boot.Metadata;
|
import org.hibernate.boot.Metadata;
|
||||||
import org.hibernate.boot.model.TruthValue;
|
|
||||||
import org.hibernate.boot.model.naming.Identifier;
|
import org.hibernate.boot.model.naming.Identifier;
|
||||||
import org.hibernate.boot.model.relational.Database;
|
import org.hibernate.boot.model.relational.Database;
|
||||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||||
|
@ -435,8 +434,8 @@ public class Column implements Selectable, Serializable, Cloneable, ColumnTypeIn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TruthValue getNullable() {
|
public Boolean getNullable() {
|
||||||
return nullable ? TruthValue.TRUE : TruthValue.FALSE;
|
return nullable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,7 +18,6 @@ import java.util.Objects;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.hibernate.JDBCException;
|
import org.hibernate.JDBCException;
|
||||||
import org.hibernate.boot.model.TruthValue;
|
|
||||||
import org.hibernate.boot.model.naming.DatabaseIdentifier;
|
import org.hibernate.boot.model.naming.DatabaseIdentifier;
|
||||||
import org.hibernate.boot.model.naming.Identifier;
|
import org.hibernate.boot.model.naming.Identifier;
|
||||||
import org.hibernate.boot.model.relational.QualifiedTableName;
|
import org.hibernate.boot.model.relational.QualifiedTableName;
|
||||||
|
@ -50,7 +49,7 @@ public abstract class AbstractInformationExtractorImpl implements InformationExt
|
||||||
|
|
||||||
private final String[] tableTypes;
|
private final String[] tableTypes;
|
||||||
|
|
||||||
private String[] extraPhysicalTableTypes;
|
private final String[] extraPhysicalTableTypes;
|
||||||
|
|
||||||
private final ExtractionContext extractionContext;
|
private final ExtractionContext extractionContext;
|
||||||
|
|
||||||
|
@ -430,8 +429,8 @@ public abstract class AbstractInformationExtractorImpl implements InformationExt
|
||||||
.getIdentifierHelper()
|
.getIdentifierHelper()
|
||||||
.toIdentifier( extractionContext.getJdbcConnection().getSchema() );
|
.toIdentifier( extractionContext.getJdbcConnection().getSchema() );
|
||||||
}
|
}
|
||||||
catch (SQLException ignore) {
|
catch (SQLException sqle) {
|
||||||
LOG.sqlWarning( ignore.getErrorCode(), ignore.getSQLState() );
|
LOG.sqlWarning( sqle.getErrorCode(), sqle.getSQLState() );
|
||||||
}
|
}
|
||||||
catch (AbstractMethodError ignore) {
|
catch (AbstractMethodError ignore) {
|
||||||
// jConnect and jTDS report that they "support" schemas, but they don't really
|
// jConnect and jTDS report that they "support" schemas, but they don't really
|
||||||
|
@ -911,25 +910,24 @@ public abstract class AbstractInformationExtractorImpl implements InformationExt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TruthValue interpretNullable(int nullable) {
|
protected Boolean interpretNullable(int nullable) {
|
||||||
switch ( nullable ) {
|
return switch ( nullable ) {
|
||||||
case ResultSetMetaData.columnNullable:
|
case ResultSetMetaData.columnNullable -> Boolean.TRUE;
|
||||||
return TruthValue.TRUE;
|
case ResultSetMetaData.columnNoNulls -> Boolean.FALSE;
|
||||||
case ResultSetMetaData.columnNoNulls:
|
default -> null;
|
||||||
return TruthValue.FALSE;
|
};
|
||||||
default:
|
|
||||||
return TruthValue.UNKNOWN;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private TruthValue interpretTruthValue(String nullable) {
|
private Boolean interpretTruthValue(String nullable) {
|
||||||
if ( "yes".equalsIgnoreCase( nullable ) ) {
|
if ( "yes".equalsIgnoreCase( nullable ) ) {
|
||||||
return TruthValue.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
else if ( "no".equalsIgnoreCase( nullable ) ) {
|
else if ( "no".equalsIgnoreCase( nullable ) ) {
|
||||||
return TruthValue.FALSE;
|
return Boolean.FALSE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
return TruthValue.UNKNOWN;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method is not currently used.
|
// This method is not currently used.
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.tool.schema.extract.internal;
|
package org.hibernate.tool.schema.extract.internal;
|
||||||
|
|
||||||
import org.hibernate.boot.model.TruthValue;
|
|
||||||
import org.hibernate.boot.model.naming.Identifier;
|
import org.hibernate.boot.model.naming.Identifier;
|
||||||
import org.hibernate.tool.schema.extract.spi.ColumnInformation;
|
import org.hibernate.tool.schema.extract.spi.ColumnInformation;
|
||||||
import org.hibernate.tool.schema.extract.spi.TableInformation;
|
import org.hibernate.tool.schema.extract.spi.TableInformation;
|
||||||
|
@ -23,7 +22,7 @@ public class ColumnInformationImpl implements ColumnInformation {
|
||||||
private final String typeName;
|
private final String typeName;
|
||||||
private final int columnSize;
|
private final int columnSize;
|
||||||
private final int decimalDigits;
|
private final int decimalDigits;
|
||||||
private final TruthValue nullable;
|
private final Boolean nullable;
|
||||||
|
|
||||||
public ColumnInformationImpl(
|
public ColumnInformationImpl(
|
||||||
TableInformation containingTableInformation,
|
TableInformation containingTableInformation,
|
||||||
|
@ -32,7 +31,7 @@ public class ColumnInformationImpl implements ColumnInformation {
|
||||||
String typeName,
|
String typeName,
|
||||||
int columnSize,
|
int columnSize,
|
||||||
int decimalDigits,
|
int decimalDigits,
|
||||||
TruthValue nullable) {
|
Boolean nullable) {
|
||||||
this.containingTableInformation = containingTableInformation;
|
this.containingTableInformation = containingTableInformation;
|
||||||
this.columnIdentifier = columnIdentifier;
|
this.columnIdentifier = columnIdentifier;
|
||||||
this.typeCode = typeCode;
|
this.typeCode = typeCode;
|
||||||
|
@ -73,7 +72,7 @@ public class ColumnInformationImpl implements ColumnInformation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TruthValue getNullable() {
|
public Boolean getNullable() {
|
||||||
return nullable;
|
return nullable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.tool.schema.extract.spi;
|
package org.hibernate.tool.schema.extract.spi;
|
||||||
|
|
||||||
import org.hibernate.boot.model.TruthValue;
|
|
||||||
import org.hibernate.boot.model.naming.Identifier;
|
import org.hibernate.boot.model.naming.Identifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,11 +28,13 @@ public interface ColumnInformation extends ColumnTypeInformation {
|
||||||
Identifier getColumnIdentifier();
|
Identifier getColumnIdentifier();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the column nullable. The database is allowed to report unknown, hence the use of TruthValue
|
* Is the column nullable.
|
||||||
|
* <p>
|
||||||
|
* The database is allowed to report unknown, hence the use of {@link Boolean}.
|
||||||
*
|
*
|
||||||
* @return nullability.
|
* @return nullability, if known
|
||||||
*/
|
*/
|
||||||
TruthValue getNullable();
|
Boolean getNullable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The JDBC type-code.
|
* The JDBC type-code.
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.hibernate.tool.schema.extract.spi;
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
|
|
||||||
import org.hibernate.Incubating;
|
import org.hibernate.Incubating;
|
||||||
import org.hibernate.boot.model.TruthValue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to information about existing table columns
|
* Provides access to information about existing table columns
|
||||||
|
@ -20,8 +19,8 @@ public interface ColumnTypeInformation {
|
||||||
|
|
||||||
ColumnTypeInformation EMPTY = new ColumnTypeInformation() {
|
ColumnTypeInformation EMPTY = new ColumnTypeInformation() {
|
||||||
@Override
|
@Override
|
||||||
public TruthValue getNullable() {
|
public Boolean getNullable() {
|
||||||
return TruthValue.UNKNOWN;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -46,11 +45,13 @@ public interface ColumnTypeInformation {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the column nullable. The database is allowed to report unknown, hence the use of TruthValue
|
* Is the column nullable.
|
||||||
|
* <p>
|
||||||
|
* The database is allowed to report unknown, hence the use of {@link Boolean}.
|
||||||
*
|
*
|
||||||
* @return nullability.
|
* @return nullability, if known
|
||||||
*/
|
*/
|
||||||
TruthValue getNullable();
|
Boolean getNullable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The JDBC type-code.
|
* The JDBC type-code.
|
||||||
|
|
|
@ -10,7 +10,6 @@ import java.util.Locale;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.hibernate.boot.model.TruthValue;
|
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.metamodel.mapping.EmbeddableMappingType;
|
import org.hibernate.metamodel.mapping.EmbeddableMappingType;
|
||||||
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||||
|
@ -165,7 +164,7 @@ public class JdbcTypeRegistry implements JdbcTypeBaseline.BaselineTarget, Serial
|
||||||
registrationKey = null;
|
registrationKey = null;
|
||||||
}
|
}
|
||||||
final JdbcType descriptor = getDescriptor( jdbcTypeCode );
|
final JdbcType descriptor = getDescriptor( jdbcTypeCode );
|
||||||
if ( !( descriptor instanceof AggregateJdbcType ) ) {
|
if ( !(descriptor instanceof AggregateJdbcType aggregateJdbcType) ) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
String.format(
|
String.format(
|
||||||
"Tried to resolve the JdbcType [%s] as AggregateJdbcType but it does not implement that interface!",
|
"Tried to resolve the JdbcType [%s] as AggregateJdbcType but it does not implement that interface!",
|
||||||
|
@ -173,7 +172,6 @@ public class JdbcTypeRegistry implements JdbcTypeBaseline.BaselineTarget, Serial
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
final AggregateJdbcType aggregateJdbcType = (AggregateJdbcType) descriptor;
|
|
||||||
final AggregateJdbcType resolvedJdbcType = aggregateJdbcType.resolveAggregateJdbcType(
|
final AggregateJdbcType resolvedJdbcType = aggregateJdbcType.resolveAggregateJdbcType(
|
||||||
embeddableMappingType,
|
embeddableMappingType,
|
||||||
typeName,
|
typeName,
|
||||||
|
@ -181,8 +179,7 @@ public class JdbcTypeRegistry implements JdbcTypeBaseline.BaselineTarget, Serial
|
||||||
);
|
);
|
||||||
if ( registrationKey != null ) {
|
if ( registrationKey != null ) {
|
||||||
aggregateDescriptorMap.put( registrationKey, resolvedJdbcType );
|
aggregateDescriptorMap.put( registrationKey, resolvedJdbcType );
|
||||||
if ( resolvedJdbcType instanceof SqlTypedJdbcType ) {
|
if ( resolvedJdbcType instanceof SqlTypedJdbcType sqlTypedJdbcType ) {
|
||||||
final SqlTypedJdbcType sqlTypedJdbcType = (SqlTypedJdbcType) resolvedJdbcType;
|
|
||||||
sqlTypedDescriptorMap.put( sqlTypedJdbcType.getSqlTypeName().toLowerCase( Locale.ROOT ), sqlTypedJdbcType );
|
sqlTypedDescriptorMap.put( sqlTypedJdbcType.getSqlTypeName().toLowerCase( Locale.ROOT ), sqlTypedJdbcType );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -295,7 +292,7 @@ public class JdbcTypeRegistry implements JdbcTypeBaseline.BaselineTarget, Serial
|
||||||
private static final class TypeConstructedJdbcTypeKey {
|
private static final class TypeConstructedJdbcTypeKey {
|
||||||
private final int typeConstructorTypeCode;
|
private final int typeConstructorTypeCode;
|
||||||
private final Object jdbcTypeOrBasicType;
|
private final Object jdbcTypeOrBasicType;
|
||||||
private final TruthValue nullable;
|
private final Boolean nullable;
|
||||||
private final int typeCode;
|
private final int typeCode;
|
||||||
private final @Nullable String typeName;
|
private final @Nullable String typeName;
|
||||||
private final int columnSize;
|
private final int columnSize;
|
||||||
|
@ -308,7 +305,7 @@ public class JdbcTypeRegistry implements JdbcTypeBaseline.BaselineTarget, Serial
|
||||||
this.typeConstructorTypeCode = typeConstructorTypeCode;
|
this.typeConstructorTypeCode = typeConstructorTypeCode;
|
||||||
this.jdbcTypeOrBasicType = jdbcTypeOrBasicType;
|
this.jdbcTypeOrBasicType = jdbcTypeOrBasicType;
|
||||||
if ( columnTypeInformation == null ) {
|
if ( columnTypeInformation == null ) {
|
||||||
this.nullable = TruthValue.UNKNOWN;
|
this.nullable = null;
|
||||||
this.typeCode = Types.OTHER;
|
this.typeCode = Types.OTHER;
|
||||||
this.typeName = null;
|
this.typeName = null;
|
||||||
this.columnSize = 0;
|
this.columnSize = 0;
|
||||||
|
|
|
@ -11,7 +11,6 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.boot.Metadata;
|
import org.hibernate.boot.Metadata;
|
||||||
import org.hibernate.boot.model.TruthValue;
|
|
||||||
import org.hibernate.boot.model.naming.Identifier;
|
import org.hibernate.boot.model.naming.Identifier;
|
||||||
import org.hibernate.boot.model.relational.Namespace;
|
import org.hibernate.boot.model.relational.Namespace;
|
||||||
import org.hibernate.boot.model.relational.Namespace.Name;
|
import org.hibernate.boot.model.relational.Namespace.Name;
|
||||||
|
@ -362,9 +361,7 @@ public class CheckForExistingForeignKeyTest {
|
||||||
String typeName = null;
|
String typeName = null;
|
||||||
int columnSize = 0;
|
int columnSize = 0;
|
||||||
int decimalDigits = 0;
|
int decimalDigits = 0;
|
||||||
TruthValue nullable = null;
|
return new ColumnInformationImpl( containingTableInformation, columnIdentifier, typeCode, typeName, columnSize,
|
||||||
ColumnInformationImpl columnInformation = new ColumnInformationImpl( containingTableInformation, columnIdentifier, typeCode, typeName, columnSize,
|
decimalDigits, null );
|
||||||
decimalDigits, nullable );
|
|
||||||
return columnInformation;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.boot.Metadata;
|
import org.hibernate.boot.Metadata;
|
||||||
import org.hibernate.boot.model.TruthValue;
|
|
||||||
import org.hibernate.boot.model.naming.Identifier;
|
import org.hibernate.boot.model.naming.Identifier;
|
||||||
import org.hibernate.boot.model.relational.Namespace;
|
import org.hibernate.boot.model.relational.Namespace;
|
||||||
import org.hibernate.boot.model.relational.QualifiedTableName;
|
import org.hibernate.boot.model.relational.QualifiedTableName;
|
||||||
|
@ -62,8 +61,8 @@ public class AbstractSchemaMigratorTest {
|
||||||
.when(destinationTableInformation).getName();
|
.when(destinationTableInformation).getName();
|
||||||
columnReferenceMappings.add(new ForeignKeyInformationImpl.ColumnReferenceMappingImpl(
|
columnReferenceMappings.add(new ForeignKeyInformationImpl.ColumnReferenceMappingImpl(
|
||||||
new ColumnInformationImpl(null, toIdentifier("referencing_column"), // column name is lower case
|
new ColumnInformationImpl(null, toIdentifier("referencing_column"), // column name is lower case
|
||||||
0, "typeName", 255, 0, TruthValue.TRUE),
|
0, "typeName", 255, 0, true),
|
||||||
new ColumnInformationImpl(destinationTableInformation, null, 1, "typeName", 0, 0, TruthValue.TRUE)));
|
new ColumnInformationImpl(destinationTableInformation, null, 1, "typeName", 0, 0, true)));
|
||||||
doReturn(singletonList(new ForeignKeyInformationImpl(toIdentifier("FKp8mpamfw2inhj88hwhty1eipm"), columnReferenceMappings)))
|
doReturn(singletonList(new ForeignKeyInformationImpl(toIdentifier("FKp8mpamfw2inhj88hwhty1eipm"), columnReferenceMappings)))
|
||||||
.when(existingTableInformation).getForeignKeys();
|
.when(existingTableInformation).getForeignKeys();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue