Skip to content

Commit

Permalink
HHH-18136 remove Table.identifierValue which was just bad
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin King <gavin@hibernate.org>
  • Loading branch information
gavinking committed May 17, 2024
1 parent 7d3d17d commit 371fe8f
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,13 @@ public static void makeIdGenerator(
Map<String, IdentifierGeneratorDefinition> localGenerators) {
LOG.debugf( "#makeIdGenerator(%s, %s, %s, %s, ...)", id, property, generatorType, generatorName );

final Table table = id.getTable();
table.setIdentifierValue( id );
//generator settings
id.setIdentifierGeneratorStrategy( generatorType );

final Map<String,Object> parameters = new HashMap<>();

//always settable
parameters.put( PersistentIdentifierGenerator.TABLE, table.getName() );
parameters.put( PersistentIdentifierGenerator.TABLE, id.getTable().getName() );

if ( id.getColumnSpan() == 1 ) {
parameters.put( PersistentIdentifierGenerator.PK, id.getColumns().get(0).getName() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,8 +800,6 @@ private void makeIdentifier(
identifierValue.setIdentifierGeneratorParameters( params );
}

identifierValue.getTable().setIdentifierValue( identifierValue );

if ( isNotEmpty( unsavedValue ) ) {
identifierValue.setNullValue( unsavedValue );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,6 @@ public boolean isColumnInsertable(int index) {
public boolean isColumnUpdateable(int index) {
return true;
}

@Override
public MetadataBuildingContext getBuildingContext() {
return table.getIdentifierValue().getBuildingContext();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,6 @@ public Generator createGenerator(
IdentifierGeneratorFactory identifierGeneratorFactory,
Dialect dialect,
RootClass rootClass) throws MappingException {
getTable().setIdentifierValue( this );

if ( generator == null ) {
if ( customIdGeneratorCreator != null ) {
generator = customIdGeneratorCreator.createGenerator(
Expand All @@ -407,7 +405,6 @@ public Generator createGenerator(
}
}
}

return generator;
}

Expand Down
9 changes: 0 additions & 9 deletions hibernate-core/src/main/java/org/hibernate/mapping/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public class Table implements Serializable, ContributableDatabaseObject {
* contains all columns, including the primary key
*/
private final Map<String, Column> columns = new LinkedHashMap<>();
private KeyValue idValue;
private PrimaryKey primaryKey;
private final Map<ForeignKeyKey, ForeignKey> foreignKeys = new LinkedHashMap<>();
private final Map<String, Index> indexes = new LinkedHashMap<>();
Expand Down Expand Up @@ -692,14 +691,6 @@ public int getUniqueInteger() {
return uniqueInteger;
}

public void setIdentifierValue(KeyValue idValue) {
this.idValue = idValue;
}

public KeyValue getIdentifierValue() {
return idValue;
}

@Deprecated(since = "6.2")
public void addCheckConstraint(String constraint) {
addCheck( new CheckConstraint( constraint ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ private static boolean isPrimaryKeyIdentity(Table table) {
return table.hasPrimaryKey()
&& table.getPrimaryKey().getColumnSpan() == 1
&& table.getPrimaryKey().getColumn( 0 ).isIdentity();

}

private static String normalize(String typeName) {
Expand Down

0 comments on commit 371fe8f

Please sign in to comment.