Skip to content

Commit 37a1655

Browse files
committed
HHH-17503 - Remove support for hbm.xml mappings
HHH-19310 - Simplified declaration of type for basic mappings in XML
1 parent f1251ea commit 37a1655

File tree

97 files changed

+1516
-3517
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1516
-3517
lines changed

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,13 @@ public Column[] getOverriddenColumn(String propertyName) {
341341

342342
private String extractUserPropertyName(String redundantString, String propertyName) {
343343
String className = component.getOwner().getClassName();
344-
boolean specialCase = propertyName.startsWith(className)
345-
&& propertyName.length() > className.length() + 2 + redundantString.length() // .id.
346-
&& propertyName.substring( className.length() + 1, className.length() + 1 + redundantString.length() )
347-
.equals(redundantString);
348-
if (specialCase) {
349-
//remove id we might be in a @IdClass case
350-
return className + propertyName.substring( className.length() + 1 + redundantString.length() );
344+
if ( className != null && propertyName.startsWith( className ) ) {
345+
boolean specialCase = propertyName.length() > className.length() + 2 + redundantString.length()
346+
&& propertyName.substring( className.length() + 1, className.length() + 1 + redundantString.length() ).equals( redundantString );
347+
if ( specialCase ) {
348+
//remove id we might be in a @IdClass case
349+
return className + propertyName.substring( className.length() + 1 + redundantString.length() );
350+
}
351351
}
352352
return null;
353353
}

hibernate-core/src/main/java/org/hibernate/boot/model/process/spi/MetadataBuildingProcess.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
import org.hibernate.engine.config.spi.ConfigurationService;
7070
import org.hibernate.engine.config.spi.StandardConverters;
7171
import org.hibernate.engine.jdbc.spi.JdbcServices;
72+
import org.hibernate.internal.util.collections.CollectionHelper;
7273
import org.hibernate.mapping.Table;
7374
import org.hibernate.models.internal.MutableClassDetailsRegistry;
7475
import org.hibernate.models.spi.ClassDetails;
@@ -452,7 +453,7 @@ public static DomainModelSource processManagedResources(
452453

453454
return new DomainModelSource(
454455
classDetailsRegistry,
455-
allKnownClassNames,
456+
CollectionHelper.mutableJoin( allKnownClassNames, xmlPreProcessingResult.getMappedNames() ),
456457
modelCategorizationCollector.getGlobalRegistrations(),
457458
rootMappingDefaults,
458459
xmlPreProcessingResult.getPersistenceUnitMetadata()

hibernate-core/src/main/java/org/hibernate/boot/models/internal/ModelsHelper.java

+22
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
*/
55
package org.hibernate.boot.models.internal;
66

7+
import java.sql.Blob;
8+
import java.sql.Clob;
9+
import java.sql.NClob;
710
import java.util.function.Supplier;
811

912
import org.hibernate.annotations.TenantId;
1013
import org.hibernate.models.internal.MutableClassDetailsRegistry;
14+
import org.hibernate.models.internal.jdk.JdkClassDetails;
1115
import org.hibernate.models.spi.ClassDetails;
1216
import org.hibernate.models.spi.ClassDetailsRegistry;
1317
import org.hibernate.models.spi.RegistryPrimer;
@@ -21,6 +25,18 @@ public class ModelsHelper {
2125
public static void preFillRegistries(RegistryPrimer.Contributions contributions, SourceModelBuildingContext buildingContext) {
2226
OrmAnnotationHelper.forEachOrmAnnotation( contributions::registerAnnotation );
2327

28+
registerPrimitive( boolean.class, buildingContext );
29+
registerPrimitive( byte.class, buildingContext );
30+
registerPrimitive( short.class, buildingContext );
31+
registerPrimitive( int.class, buildingContext );
32+
registerPrimitive( long.class, buildingContext );
33+
registerPrimitive( double.class, buildingContext );
34+
registerPrimitive( float.class, buildingContext );
35+
registerPrimitive( char.class, buildingContext );
36+
registerPrimitive( Blob.class, buildingContext );
37+
registerPrimitive( Clob.class, buildingContext );
38+
registerPrimitive( NClob.class, buildingContext );
39+
2440
buildingContext.getAnnotationDescriptorRegistry().getDescriptor( TenantId.class );
2541

2642
// if ( buildingContext instanceof JandexModelBuildingContext ) {
@@ -57,6 +73,12 @@ public static void preFillRegistries(RegistryPrimer.Contributions contributions,
5773
// }
5874
}
5975

76+
private static void registerPrimitive(Class<?> theClass, SourceModelBuildingContext buildingContext) {
77+
final MutableClassDetailsRegistry classDetailsRegistry = buildingContext.getClassDetailsRegistry().as( MutableClassDetailsRegistry.class );
78+
classDetailsRegistry.addClassDetails( new JdkClassDetails( theClass, buildingContext ) );
79+
80+
}
81+
6082
public static ClassDetails resolveClassDetails(
6183
String className,
6284
ClassDetailsRegistry classDetailsRegistry,

0 commit comments

Comments
 (0)