Skip to content

Commit 1376b12

Browse files
gunnarmorlingsebersole
authored andcommitted
HHH-10073 Not propagating XML node names configured in mappings
1 parent 6f215a9 commit 1376b12

File tree

19 files changed

+12
-168
lines changed

19 files changed

+12
-168
lines changed

hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,6 @@ else if ( entitySource.isLazy() ) {
434434

435435
if ( StringHelper.isNotEmpty( entitySource.getXmlNodeName() ) ) {
436436
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfDomEntityModeSupport();
437-
entityDescriptor.setNodeName( entitySource.getXmlNodeName() );
438437
}
439438

440439
entityDescriptor.setDynamicInsert( entitySource.isDynamicInsert() );
@@ -918,7 +917,6 @@ private void bindNonAggregatedCompositeEntityIdentifier(
918917
rootEntityDescriptor.setIdentifierMapper(mapper);
919918
Property property = new Property();
920919
property.setName( PropertyPath.IDENTIFIER_MAPPER_PROPERTY );
921-
property.setNodeName( "id" );
922920
property.setUpdateable( false );
923921
property.setInsertable( false );
924922
property.setValue( mapper );
@@ -1886,9 +1884,9 @@ public String getPropertyAccessorName() {
18861884
attribute
18871885
);
18881886

1889-
final String xmlNodeName = determineXmlNodeName( embeddedSource, componentBinding.getOwner().getNodeName() );
1890-
componentBinding.setNodeName( xmlNodeName );
1891-
attribute.setNodeName( xmlNodeName );
1887+
if ( StringHelper.isNotEmpty( embeddedSource.getName() ) ) {
1888+
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfDomEntityModeSupport();
1889+
}
18921890

18931891
return attribute;
18941892
}
@@ -2438,7 +2436,10 @@ private void bindProperty(
24382436
AttributeSource propertySource,
24392437
Property property) {
24402438
property.setName( propertySource.getName() );
2441-
property.setNodeName( determineXmlNodeName( propertySource, null ) );
2439+
2440+
if ( StringHelper.isNotEmpty( propertySource.getName() ) ) {
2441+
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfDomEntityModeSupport();
2442+
}
24422443

24432444
property.setPropertyAccessorName(
24442445
StringHelper.isNotEmpty( propertySource.getPropertyAccessorName() )
@@ -2538,21 +2539,6 @@ private void bindProperty(
25382539
}
25392540
}
25402541

2541-
private String determineXmlNodeName(AttributeSource propertySource, String fallbackXmlNodeName) {
2542-
String nodeName = propertySource.getXmlNodeName();
2543-
if ( StringHelper.isNotEmpty( nodeName ) ) {
2544-
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfDomEntityModeSupport();
2545-
}
2546-
else {
2547-
nodeName = propertySource.getName();
2548-
}
2549-
if ( nodeName == null ) {
2550-
nodeName = fallbackXmlNodeName;
2551-
}
2552-
2553-
return nodeName;
2554-
}
2555-
25562542
private void bindComponent(
25572543
MappingDocument sourceDocument,
25582544
EmbeddableSource embeddableSource,
@@ -2662,13 +2648,6 @@ else if ( componentBinding.getOwner().hasPojoRepresentation() ) {
26622648
if ( StringHelper.isNotEmpty( nodeName ) ) {
26632649
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfDomEntityModeSupport();
26642650
}
2665-
else {
2666-
nodeName = propertyName;
2667-
}
2668-
if ( nodeName == null ) {
2669-
nodeName = componentBinding.getOwner().getNodeName();
2670-
}
2671-
componentBinding.setNodeName( nodeName );
26722651

26732652
// todo : anything else to pass along?
26742653
bindAllCompositeAttributes(
@@ -3986,7 +3965,6 @@ public MetadataBuildingContext getBuildingContext() {
39863965

39873966
collectionBinding.setIndex( indexBinding );
39883967
collectionBinding.setBaseIndex( indexSource.getBase() );
3989-
collectionBinding.setIndexNodeName( indexSource.getXmlNodeName() );
39903968
}
39913969

39923970
private void bindMapKey(
@@ -4027,7 +4005,6 @@ public Identifier determineImplicitName(LocalMetadataBuildingContext context) {
40274005
);
40284006

40294007
collectionBinding.setIndex( value );
4030-
collectionBinding.setIndexNodeName( mapKeySource.getXmlNodeName() );
40314008
}
40324009
else if ( pluralAttributeSource.getIndexSource() instanceof PluralAttributeMapKeySourceEmbedded ) {
40334010
final PluralAttributeMapKeySourceEmbedded mapKeySource =

hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,6 @@ private static boolean mapAsIdClass(
10361036

10371037
Property property = new Property();
10381038
property.setName( PropertyPath.IDENTIFIER_MAPPER_PROPERTY );
1039-
property.setNodeName( "id" );
10401039
property.setUpdateable( false );
10411040
property.setInsertable( false );
10421041
property.setValue( mapper );
@@ -2672,7 +2671,6 @@ public static Component createComponent(
26722671
else {
26732672
comp.setComponentClassName( inferredData.getClassOrElementName() );
26742673
}
2675-
comp.setNodeName( inferredData.getPropertyName() );
26762674
return comp;
26772675
}
26782676

hibernate-core/src/main/java/org/hibernate/cfg/BinderHelper.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ public static Property shallowCopy(Property property) {
8888
clone.setInsertable( property.isInsertable() );
8989
clone.setLazy( property.isLazy() );
9090
clone.setName( property.getName() );
91-
clone.setNodeName( property.getNodeName() );
9291
clone.setNaturalIdentifier( property.isNaturalIdentifier() );
9392
clone.setOptimisticLocked( property.isOptimisticLocked() );
9493
clone.setOptional( property.isOptional() );
@@ -266,7 +265,6 @@ public static void createSyntheticPropertyReference(
266265
new Component( context.getMetadataCollector(), (PersistentClass) columnOwner ) :
267266
new Component( context.getMetadataCollector(), (Join) columnOwner );
268267
embeddedComp.setEmbedded( true );
269-
embeddedComp.setNodeName( syntheticPropertyName );
270268
embeddedComp.setComponentClassName( embeddedComp.getOwner().getClassName() );
271269
for (Property property : properties) {
272270
Property clone = BinderHelper.shallowCopy( property );
@@ -278,7 +276,6 @@ public static void createSyntheticPropertyReference(
278276
}
279277
synthProp = new SyntheticProperty();
280278
synthProp.setName( syntheticPropertyName );
281-
synthProp.setNodeName( syntheticPropertyName );
282279
synthProp.setPersistentClass( ownerEntity );
283280
synthProp.setUpdateable( false );
284281
synthProp.setInsertable( false );

hibernate-core/src/main/java/org/hibernate/cfg/CopyIdentifierComponentSecondPass.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ public void doSecondPass(Map persistentClasses) throws MappingException {
9494
else {
9595
Property property = new Property();
9696
property.setName( referencedProperty.getName() );
97-
property.setNodeName( referencedProperty.getNodeName() );
9897
//FIXME set optional?
9998
//property.setOptional( property.isOptional() );
10099
property.setPersistentClass( component.getOwner() );

hibernate-core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ public void bind() {
385385
String role = StringHelper.qualify( propertyHolder.getPath(), propertyName );
386386
LOG.debugf( "Collection role: %s", role );
387387
collection.setRole( role );
388-
collection.setNodeName( propertyName );
389388
collection.setMappedByProperty( mappedBy );
390389

391390
if ( property.isAnnotationPresent( MapKeyColumn.class )

hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ public void setInsertableDiscriminator(boolean insertableDiscriminator) {
233233
public void bindEntity() {
234234
persistentClass.setAbstract( annotatedClass.isAbstract() );
235235
persistentClass.setClassName( annotatedClass.getName() );
236-
persistentClass.setNodeName( name );
237236
persistentClass.setJpaEntityName(name);
238237
//persistentClass.setDynamic(false); //no longer needed with the Entity name refactoring?
239238
persistentClass.setEntityName( annotatedClass.getName() );

hibernate-core/src/main/java/org/hibernate/cfg/annotations/MapBinder.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,6 @@ else if ( element instanceof DependantValue ) {
352352
Iterator properties = component.getPropertyIterator();
353353
Component indexComponent = new Component( getBuildingContext().getMetadataCollector(), collection );
354354
indexComponent.setComponentClassName( component.getComponentClassName() );
355-
//TODO I don't know if this is appropriate
356-
indexComponent.setNodeName( "index" );
357355
while ( properties.hasNext() ) {
358356
Property current = (Property) properties.next();
359357
Property newProperty = new Property();
@@ -363,7 +361,6 @@ else if ( element instanceof DependantValue ) {
363361
newProperty.setUpdateable( false );
364362
newProperty.setMetaAttributes( current.getMetaAttributes() );
365363
newProperty.setName( current.getName() );
366-
newProperty.setNodeName( current.getNodeName() );
367364
newProperty.setNaturalIdentifier( false );
368365
//newProperty.setOptimisticLocked( false );
369366
newProperty.setOptional( false );

hibernate-core/src/main/java/org/hibernate/cfg/annotations/PropertyBinder.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ public Property makeProperty() {
260260
LOG.debugf( "Building property %s", name );
261261
Property prop = new Property();
262262
prop.setName( name );
263-
prop.setNodeName( name );
264263
prop.setValue( value );
265264
prop.setLazy( lazy );
266265
prop.setCascade( cascade );

hibernate-core/src/main/java/org/hibernate/mapping/Collection.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ public abstract class Collection implements Fetchable, Value, Filterable {
5454
private String manyToManyWhere;
5555
private String manyToManyOrderBy;
5656
private String referencedPropertyName;
57-
private String nodeName;
58-
private String elementNodeName;
5957
private String mappedByProperty;
6058
private boolean sorted;
6159
private Comparator comparator;
@@ -319,16 +317,6 @@ public void validate(Mapping mapping) throws MappingException {
319317
}
320318

321319
checkColumnDuplication();
322-
323-
if ( elementNodeName != null && elementNodeName.startsWith( "@" ) ) {
324-
throw new MappingException( "element node must not be an attribute: " + elementNodeName );
325-
}
326-
if ( elementNodeName != null && elementNodeName.equals( "." ) ) {
327-
throw new MappingException( "element node must not be the parent: " + elementNodeName );
328-
}
329-
if ( nodeName != null && nodeName.indexOf( '@' ) > -1 ) {
330-
throw new MappingException( "collection node must not be an attribute: " + elementNodeName );
331-
}
332320
}
333321

334322
private void checkColumnDuplication(java.util.Set distinctColumns, Iterator columns)
@@ -645,22 +633,6 @@ public boolean[] getColumnUpdateability() {
645633
return ArrayHelper.EMPTY_BOOLEAN_ARRAY;
646634
}
647635

648-
public String getNodeName() {
649-
return nodeName;
650-
}
651-
652-
public void setNodeName(String nodeName) {
653-
this.nodeName = nodeName;
654-
}
655-
656-
public String getElementNodeName() {
657-
return elementNodeName;
658-
}
659-
660-
public void setElementNodeName(String elementNodeName) {
661-
this.elementNodeName = elementNodeName;
662-
}
663-
664636
public boolean isSubselectLoadable() {
665637
return subselectLoadable;
666638
}

hibernate-core/src/main/java/org/hibernate/mapping/Component.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public class Component extends SimpleValue implements MetaAttributable {
4545
private PersistentClass owner;
4646
private boolean dynamic;
4747
private Map metaAttributes;
48-
private String nodeName;
4948
private boolean isKey;
5049
private String roleName;
5150

@@ -229,14 +228,6 @@ public boolean[] getColumnUpdateability() {
229228
return result;
230229
}
231230

232-
public String getNodeName() {
233-
return nodeName;
234-
}
235-
236-
public void setNodeName(String nodeName) {
237-
this.nodeName = nodeName;
238-
}
239-
240231
public boolean isKey() {
241232
return isKey;
242233
}

hibernate-core/src/main/java/org/hibernate/mapping/IndexedCollection.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public abstract class IndexedCollection extends Collection {
2222
public static final String DEFAULT_INDEX_COLUMN_NAME = "idx";
2323

2424
private Value index;
25-
private String indexNodeName;
2625

2726
public IndexedCollection(MetadataImplementor metadata, PersistentClass owner) {
2827
super( metadata, owner );
@@ -84,22 +83,9 @@ public void validate(Mapping mapping) throws MappingException {
8483
getIndex().getType().getName()
8584
);
8685
}
87-
if ( indexNodeName!=null && !indexNodeName.startsWith("@") ) {
88-
throw new MappingException("index node must be an attribute: " + indexNodeName );
89-
}
9086
}
9187

9288
public boolean isList() {
9389
return false;
9490
}
95-
96-
public String getIndexNodeName() {
97-
return indexNodeName;
98-
}
99-
100-
public void setIndexNodeName(String indexNodeName) {
101-
this.indexNodeName = indexNodeName;
102-
}
103-
104-
10591
}

hibernate-core/src/main/java/org/hibernate/mapping/PersistentClass.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
5151
private String proxyInterfaceName;
5252
private transient Class proxyInterface;
5353

54-
private String nodeName;
5554
private String jpaEntityName;
5655

5756
private String discriminatorValue;
@@ -815,14 +814,6 @@ protected void checkColumnDuplication() {
815814

816815
public abstract Object accept(PersistentClassVisitor mv);
817816

818-
public String getNodeName() {
819-
return nodeName;
820-
}
821-
822-
public void setNodeName(String nodeName) {
823-
this.nodeName = nodeName;
824-
}
825-
826817
public String getJpaEntityName() {
827818
return jpaEntityName;
828819
}
@@ -835,10 +826,6 @@ public boolean hasPojoRepresentation() {
835826
return getClassName() != null;
836827
}
837828

838-
public boolean hasDom4jRepresentation() {
839-
return getNodeName() != null;
840-
}
841-
842829
public boolean hasSubselectLoadableCollections() {
843830
return hasSubselectLoadableCollections;
844831
}

hibernate-core/src/main/java/org/hibernate/mapping/Property.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public class Property implements Serializable, MetaAttributable {
4444
private String propertyAccessorName;
4545
private boolean lazy;
4646
private boolean optional;
47-
private String nodeName;
4847
private java.util.Map metaAttributes;
4948
private PersistentClass persistentClass;
5049
private boolean naturalIdentifier;
@@ -291,14 +290,6 @@ public void setSelectable(boolean selectable) {
291290
this.selectable = selectable;
292291
}
293292

294-
public String getNodeName() {
295-
return nodeName;
296-
}
297-
298-
public void setNodeName(String nodeName) {
299-
this.nodeName = nodeName;
300-
}
301-
302293
public String getAccessorPropertyName( EntityMode mode ) {
303294
return getName();
304295
}

0 commit comments

Comments
 (0)