Skip to content

Commit eab0377

Browse files
committed
Rebase main -> 7.0
1 parent df5ba05 commit eab0377

File tree

6 files changed

+26
-41
lines changed

6 files changed

+26
-41
lines changed

hibernate-core/src/main/java/org/hibernate/boot/model/internal/AggregateComponentBinder.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ public static void processAggregate(
4141
Component component,
4242
PropertyHolder propertyHolder,
4343
PropertyData inferredData,
44-
ClassDetails returnedClassOrElement,
44+
ClassDetails componentClassDetails,
4545
AnnotatedColumns columns,
4646
MetadataBuildingContext context) {
47-
if ( isAggregate( inferredData.getAttributeMember(), inferredData.getClassOrElementType(), context ) ) {
47+
if ( isAggregate( inferredData.getAttributeMember(), componentClassDetails, context ) ) {
4848
final InFlightMetadataCollector metadataCollector = context.getMetadataCollector();
4949
final TypeConfiguration typeConfiguration = metadataCollector.getTypeConfiguration();
5050
// Determine a struct name if this is a struct through some means
51-
final QualifiedName structQualifiedName = determineStructName( columns, inferredData, returnedClassOrElement, context );
51+
final QualifiedName structQualifiedName = determineStructName( columns, inferredData, componentClassDetails, context );
5252
final String structName = structQualifiedName == null ? null : structQualifiedName.render();
5353

5454
// We must register a special JavaType for the embeddable which can provide a recommended JdbcType
@@ -57,7 +57,7 @@ public static void processAggregate(
5757
() -> new EmbeddableAggregateJavaType<>( component.getComponentClass(), structName )
5858
);
5959
component.setStructName( structQualifiedName );
60-
component.setStructColumnNames( determineStructAttributeNames( inferredData, returnedClassOrElement ) );
60+
component.setStructColumnNames( determineStructAttributeNames( inferredData, componentClassDetails ) );
6161

6262
// Determine the aggregate column
6363
BasicValueBinder basicValueBinder = new BasicValueBinder( BasicValueBinder.Kind.ATTRIBUTE, component, context );
@@ -98,7 +98,7 @@ public static void processAggregate(
9898
new AggregateComponentSecondPass(
9999
propertyHolder,
100100
component,
101-
returnedClassOrElement,
101+
componentClassDetails,
102102
inferredData.getPropertyName(),
103103
context
104104
)
@@ -191,7 +191,7 @@ private static String[] determineStructAttributeNames(PropertyData inferredData,
191191

192192
private static boolean isAggregate(
193193
MemberDetails property,
194-
TypeDetails returnedClass,
194+
ClassDetails returnedClass,
195195
MetadataBuildingContext context) {
196196
if ( property != null ) {
197197
if ( property.hasDirectAnnotationUsage( Struct.class ) ) {
@@ -215,7 +215,7 @@ private static boolean isAggregate(
215215
}
216216

217217
if ( returnedClass != null ) {
218-
return returnedClass.determineRawClass().hasDirectAnnotationUsage( Struct.class );
218+
return returnedClass.hasDirectAnnotationUsage( Struct.class );
219219
}
220220

221221
return false;

hibernate-core/src/main/java/org/hibernate/boot/model/internal/AggregateComponentSecondPass.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import org.hibernate.AnnotationException;
1515
import org.hibernate.MappingException;
1616
import org.hibernate.annotations.Comment;
17-
import org.hibernate.boot.model.naming.Identifier;
1817
import org.hibernate.boot.model.relational.Database;
1918
import org.hibernate.boot.model.relational.Namespace;
2019
import org.hibernate.boot.model.relational.QualifiedName;
@@ -49,19 +48,19 @@ public class AggregateComponentSecondPass implements SecondPass {
4948

5049
private final PropertyHolder propertyHolder;
5150
private final Component component;
52-
private final ClassDetails returnedClassOrElement;
51+
private final ClassDetails componentClassDetails;
5352
private final String propertyName;
5453
private final MetadataBuildingContext context;
5554

5655
public AggregateComponentSecondPass(
5756
PropertyHolder propertyHolder,
5857
Component component,
59-
ClassDetails returnedClassOrElement,
58+
ClassDetails componentClassDetails,
6059
String propertyName,
6160
MetadataBuildingContext context) {
6261
this.propertyHolder = propertyHolder;
6362
this.component = component;
64-
this.returnedClassOrElement = returnedClassOrElement;
63+
this.componentClassDetails = componentClassDetails;
6564
this.propertyName = propertyName;
6665
this.context = context;
6766
}
@@ -94,7 +93,7 @@ public void doSecondPass(Map<String, PersistentClass> persistentClasses) throws
9493
structName.getSchemaName()
9594
);
9695
final UserDefinedObjectType udt = new UserDefinedObjectType( "orm", namespace, structName.getObjectName() );
97-
final Comment comment = returnedClassOrElement.getDirectAnnotationUsage( Comment.class );
96+
final Comment comment = componentClassDetails.getDirectAnnotationUsage( Comment.class );
9897
if ( comment != null ) {
9998
udt.setComment( comment.value() );
10099
}
@@ -433,7 +432,7 @@ else if ( !column1.getSqlType().equals( column2.getSqlType() ) ) {
433432
String.format(
434433
"Struct [%s] of class [%s] is defined by multiple components with different mappings [%s] and [%s] for column [%s]",
435434
udt1.getName(),
436-
returnedClassOrElement.getName(),
435+
componentClassDetails.getName(),
437436
column1.getSqlType(),
438437
column2.getSqlType(),
439438
column1.getCanonicalName()
@@ -448,7 +447,7 @@ else if ( !column1.getSqlType().equals( column2.getSqlType() ) ) {
448447
"Struct [%s] is defined by multiple components %s but some columns are missing in [%s]: %s",
449448
udt1.getName(),
450449
findComponentClasses(),
451-
returnedClassOrElement.getName(),
450+
componentClassDetails.getName(),
452451
missingColumns
453452
)
454453
);

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/EmbeddableWithArrayAggregate.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
import java.net.MalformedURLException;
1010
import java.net.URL;
11-
import java.sql.Blob;
12-
import java.sql.Clob;
1311
import java.sql.Time;
1412
import java.sql.Timestamp;
1513
import java.time.Duration;
@@ -26,8 +24,6 @@
2624

2725
import org.hibernate.Length;
2826
import org.hibernate.annotations.JdbcTypeCode;
29-
import org.hibernate.engine.jdbc.BlobProxy;
30-
import org.hibernate.engine.jdbc.ClobProxy;
3127
import org.hibernate.type.NumericBooleanConverter;
3228
import org.hibernate.type.SqlTypes;
3329
import org.hibernate.type.YesNoConverter;
@@ -283,7 +279,7 @@ public void setTheDuration(Duration[] theDuration) {
283279
}
284280

285281
@JdbcTypeCode(SqlTypes.ARRAY)
286-
public Boolean[] isTheBoolean() {
282+
public Boolean[] getTheBoolean() {
287283
return theBoolean;
288284
}
289285

@@ -293,7 +289,7 @@ public void setTheBoolean(Boolean[] theBoolean) {
293289

294290
@Convert(converter = NumericBooleanConverter.class)
295291
@JdbcTypeCode(SqlTypes.ARRAY)
296-
public Boolean[] isTheNumericBoolean() {
292+
public Boolean[] getTheNumericBoolean() {
297293
return theNumericBoolean;
298294
}
299295

@@ -303,7 +299,7 @@ public void setTheNumericBoolean(Boolean[] theNumericBoolean) {
303299

304300
@Convert(converter = YesNoConverter.class)
305301
@JdbcTypeCode(SqlTypes.ARRAY)
306-
public Boolean[] isTheStringBoolean() {
302+
public Boolean[] getTheStringBoolean() {
307303
return theStringBoolean;
308304
}
309305

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/JsonWithArrayEmbeddableTest.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
package org.hibernate.orm.test.mapping.embeddable;
88

99
import java.net.URL;
10-
import java.sql.Clob;
1110
import java.sql.Time;
1211
import java.sql.Timestamp;
1312
import java.time.Duration;
@@ -22,13 +21,9 @@
2221
import java.util.UUID;
2322

2423
import org.hibernate.annotations.JdbcTypeCode;
25-
import org.hibernate.annotations.Struct;
2624
import org.hibernate.cfg.AvailableSettings;
27-
import org.hibernate.dialect.Dialect;
2825
import org.hibernate.dialect.OracleDialect;
29-
import org.hibernate.dialect.PostgreSQLDialect;
30-
import org.hibernate.procedure.ProcedureCall;
31-
import org.hibernate.query.procedure.ProcedureParameter;
26+
3227
import org.hibernate.testing.orm.junit.SkipForDialect;
3328
import org.hibernate.type.SqlTypes;
3429

@@ -50,7 +45,6 @@
5045

5146
import jakarta.persistence.Entity;
5247
import jakarta.persistence.Id;
53-
import jakarta.persistence.ParameterMode;
5448
import jakarta.persistence.Tuple;
5549

5650
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
@@ -290,9 +284,9 @@ public void testUpdateAllAggregateMembers(SessionFactoryScope scope) {
290284
)
291285
.setParameter( "theInt", struct.getTheInt() )
292286
.setParameter( "theDouble", struct.getTheDouble() )
293-
.setParameter( "theBoolean", struct.isTheBoolean() )
294-
.setParameter( "theNumericBoolean", struct.isTheNumericBoolean() )
295-
.setParameter( "theStringBoolean", struct.isTheStringBoolean() )
287+
.setParameter( "theBoolean", struct.getTheBoolean() )
288+
.setParameter( "theNumericBoolean", struct.getTheNumericBoolean() )
289+
.setParameter( "theStringBoolean", struct.getTheStringBoolean() )
296290
.setParameter( "theString", struct.getTheString() )
297291
.setParameter( "theInteger", struct.getTheInteger() )
298292
.setParameter( "theUrl", struct.getTheUrl() )

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/NestedStructWithArrayEmbeddableTest.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@
2525
import org.hibernate.annotations.JdbcTypeCode;
2626
import org.hibernate.annotations.Struct;
2727
import org.hibernate.cfg.AvailableSettings;
28-
import org.hibernate.dialect.Dialect;
2928
import org.hibernate.dialect.OracleDialect;
3029
import org.hibernate.dialect.PostgreSQLDialect;
31-
import org.hibernate.procedure.ProcedureCall;
32-
import org.hibernate.query.procedure.ProcedureParameter;
3330
import org.hibernate.type.SqlTypes;
3431

3532
import org.hibernate.testing.jdbc.SharedDriverManagerTypeCacheClearingIntegrator;
@@ -52,7 +49,6 @@
5249
import jakarta.persistence.Embeddable;
5350
import jakarta.persistence.Entity;
5451
import jakarta.persistence.Id;
55-
import jakarta.persistence.ParameterMode;
5652
import jakarta.persistence.Tuple;
5753

5854
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
@@ -325,9 +321,9 @@ public void testUpdateAllAggregateMembers(SessionFactoryScope scope) {
325321
)
326322
.setParameter( "theInt", struct.getTheInt() )
327323
.setParameter( "theDouble", struct.getTheDouble() )
328-
.setParameter( "theBoolean", struct.isTheBoolean() )
329-
.setParameter( "theNumericBoolean", struct.isTheNumericBoolean() )
330-
.setParameter( "theStringBoolean", struct.isTheStringBoolean() )
324+
.setParameter( "theBoolean", struct.getTheBoolean() )
325+
.setParameter( "theNumericBoolean", struct.getTheNumericBoolean() )
326+
.setParameter( "theStringBoolean", struct.getTheStringBoolean() )
331327
.setParameter( "theString", struct.getTheString() )
332328
.setParameter( "theInteger", struct.getTheInteger() )
333329
.setParameter( "theUrl", struct.getTheUrl() )

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/embeddable/StructWithArrayEmbeddableTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,9 @@ public void testUpdateAllAggregateMembers(SessionFactoryScope scope) {
433433
)
434434
.setParameter( "theInt", struct.getTheInt() )
435435
.setParameter( "theDouble", struct.getTheDouble() )
436-
.setParameter( "theBoolean", struct.isTheBoolean() )
437-
.setParameter( "theNumericBoolean", struct.isTheNumericBoolean() )
438-
.setParameter( "theStringBoolean", struct.isTheStringBoolean() )
436+
.setParameter( "theBoolean", struct.getTheBoolean() )
437+
.setParameter( "theNumericBoolean", struct.getTheNumericBoolean() )
438+
.setParameter( "theStringBoolean", struct.getTheStringBoolean() )
439439
.setParameter( "theString", struct.getTheString() )
440440
.setParameter( "theInteger", struct.getTheInteger() )
441441
.setParameter( "theUrl", struct.getTheUrl() )

0 commit comments

Comments
 (0)