HHH-10073 Not propagating XML node names configured in mappings
(cherry picked from commit 1376b12ca9
)
This commit is contained in:
parent
3059e58fb8
commit
9d071183a4
|
@ -434,7 +434,6 @@ public class ModelBinder {
|
|||
|
||||
if ( StringHelper.isNotEmpty( entitySource.getXmlNodeName() ) ) {
|
||||
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfDomEntityModeSupport();
|
||||
entityDescriptor.setNodeName( entitySource.getXmlNodeName() );
|
||||
}
|
||||
|
||||
entityDescriptor.setDynamicInsert( entitySource.isDynamicInsert() );
|
||||
|
@ -918,7 +917,6 @@ public class ModelBinder {
|
|||
rootEntityDescriptor.setIdentifierMapper(mapper);
|
||||
Property property = new Property();
|
||||
property.setName( PropertyPath.IDENTIFIER_MAPPER_PROPERTY );
|
||||
property.setNodeName( "id" );
|
||||
property.setUpdateable( false );
|
||||
property.setInsertable( false );
|
||||
property.setValue( mapper );
|
||||
|
@ -1886,9 +1884,9 @@ public class ModelBinder {
|
|||
attribute
|
||||
);
|
||||
|
||||
final String xmlNodeName = determineXmlNodeName( embeddedSource, componentBinding.getOwner().getNodeName() );
|
||||
componentBinding.setNodeName( xmlNodeName );
|
||||
attribute.setNodeName( xmlNodeName );
|
||||
if ( StringHelper.isNotEmpty( embeddedSource.getName() ) ) {
|
||||
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfDomEntityModeSupport();
|
||||
}
|
||||
|
||||
return attribute;
|
||||
}
|
||||
|
@ -2438,7 +2436,10 @@ public class ModelBinder {
|
|||
AttributeSource propertySource,
|
||||
Property property) {
|
||||
property.setName( propertySource.getName() );
|
||||
property.setNodeName( determineXmlNodeName( propertySource, null ) );
|
||||
|
||||
if ( StringHelper.isNotEmpty( propertySource.getName() ) ) {
|
||||
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfDomEntityModeSupport();
|
||||
}
|
||||
|
||||
property.setPropertyAccessorName(
|
||||
StringHelper.isNotEmpty( propertySource.getPropertyAccessorName() )
|
||||
|
@ -2538,21 +2539,6 @@ public class ModelBinder {
|
|||
}
|
||||
}
|
||||
|
||||
private String determineXmlNodeName(AttributeSource propertySource, String fallbackXmlNodeName) {
|
||||
String nodeName = propertySource.getXmlNodeName();
|
||||
if ( StringHelper.isNotEmpty( nodeName ) ) {
|
||||
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfDomEntityModeSupport();
|
||||
}
|
||||
else {
|
||||
nodeName = propertySource.getName();
|
||||
}
|
||||
if ( nodeName == null ) {
|
||||
nodeName = fallbackXmlNodeName;
|
||||
}
|
||||
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
private void bindComponent(
|
||||
MappingDocument sourceDocument,
|
||||
EmbeddableSource embeddableSource,
|
||||
|
@ -2662,13 +2648,6 @@ public class ModelBinder {
|
|||
if ( StringHelper.isNotEmpty( nodeName ) ) {
|
||||
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfDomEntityModeSupport();
|
||||
}
|
||||
else {
|
||||
nodeName = propertyName;
|
||||
}
|
||||
if ( nodeName == null ) {
|
||||
nodeName = componentBinding.getOwner().getNodeName();
|
||||
}
|
||||
componentBinding.setNodeName( nodeName );
|
||||
|
||||
// todo : anything else to pass along?
|
||||
bindAllCompositeAttributes(
|
||||
|
@ -3986,7 +3965,6 @@ public class ModelBinder {
|
|||
|
||||
collectionBinding.setIndex( indexBinding );
|
||||
collectionBinding.setBaseIndex( indexSource.getBase() );
|
||||
collectionBinding.setIndexNodeName( indexSource.getXmlNodeName() );
|
||||
}
|
||||
|
||||
private void bindMapKey(
|
||||
|
@ -4027,7 +4005,6 @@ public class ModelBinder {
|
|||
);
|
||||
|
||||
collectionBinding.setIndex( value );
|
||||
collectionBinding.setIndexNodeName( mapKeySource.getXmlNodeName() );
|
||||
}
|
||||
else if ( pluralAttributeSource.getIndexSource() instanceof PluralAttributeMapKeySourceEmbedded ) {
|
||||
final PluralAttributeMapKeySourceEmbedded mapKeySource =
|
||||
|
|
|
@ -1036,7 +1036,6 @@ public final class AnnotationBinder {
|
|||
|
||||
Property property = new Property();
|
||||
property.setName( PropertyPath.IDENTIFIER_MAPPER_PROPERTY );
|
||||
property.setNodeName( "id" );
|
||||
property.setUpdateable( false );
|
||||
property.setInsertable( false );
|
||||
property.setValue( mapper );
|
||||
|
@ -2672,7 +2671,6 @@ public final class AnnotationBinder {
|
|||
else {
|
||||
comp.setComponentClassName( inferredData.getClassOrElementName() );
|
||||
}
|
||||
comp.setNodeName( inferredData.getPropertyName() );
|
||||
return comp;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,6 @@ public class BinderHelper {
|
|||
clone.setInsertable( property.isInsertable() );
|
||||
clone.setLazy( property.isLazy() );
|
||||
clone.setName( property.getName() );
|
||||
clone.setNodeName( property.getNodeName() );
|
||||
clone.setNaturalIdentifier( property.isNaturalIdentifier() );
|
||||
clone.setOptimisticLocked( property.isOptimisticLocked() );
|
||||
clone.setOptional( property.isOptional() );
|
||||
|
@ -266,7 +265,6 @@ public class BinderHelper {
|
|||
new Component( context.getMetadataCollector(), (PersistentClass) columnOwner ) :
|
||||
new Component( context.getMetadataCollector(), (Join) columnOwner );
|
||||
embeddedComp.setEmbedded( true );
|
||||
embeddedComp.setNodeName( syntheticPropertyName );
|
||||
embeddedComp.setComponentClassName( embeddedComp.getOwner().getClassName() );
|
||||
for (Property property : properties) {
|
||||
Property clone = BinderHelper.shallowCopy( property );
|
||||
|
@ -278,7 +276,6 @@ public class BinderHelper {
|
|||
}
|
||||
synthProp = new SyntheticProperty();
|
||||
synthProp.setName( syntheticPropertyName );
|
||||
synthProp.setNodeName( syntheticPropertyName );
|
||||
synthProp.setPersistentClass( ownerEntity );
|
||||
synthProp.setUpdateable( false );
|
||||
synthProp.setInsertable( false );
|
||||
|
|
|
@ -94,7 +94,6 @@ public class CopyIdentifierComponentSecondPass implements SecondPass {
|
|||
else {
|
||||
Property property = new Property();
|
||||
property.setName( referencedProperty.getName() );
|
||||
property.setNodeName( referencedProperty.getNodeName() );
|
||||
//FIXME set optional?
|
||||
//property.setOptional( property.isOptional() );
|
||||
property.setPersistentClass( component.getOwner() );
|
||||
|
|
|
@ -385,7 +385,6 @@ public abstract class CollectionBinder {
|
|||
String role = StringHelper.qualify( propertyHolder.getPath(), propertyName );
|
||||
LOG.debugf( "Collection role: %s", role );
|
||||
collection.setRole( role );
|
||||
collection.setNodeName( propertyName );
|
||||
collection.setMappedByProperty( mappedBy );
|
||||
|
||||
if ( property.isAnnotationPresent( MapKeyColumn.class )
|
||||
|
|
|
@ -233,7 +233,6 @@ public class EntityBinder {
|
|||
public void bindEntity() {
|
||||
persistentClass.setAbstract( annotatedClass.isAbstract() );
|
||||
persistentClass.setClassName( annotatedClass.getName() );
|
||||
persistentClass.setNodeName( name );
|
||||
persistentClass.setJpaEntityName(name);
|
||||
//persistentClass.setDynamic(false); //no longer needed with the Entity name refactoring?
|
||||
persistentClass.setEntityName( annotatedClass.getName() );
|
||||
|
|
|
@ -352,8 +352,6 @@ public class MapBinder extends CollectionBinder {
|
|||
Iterator properties = component.getPropertyIterator();
|
||||
Component indexComponent = new Component( getBuildingContext().getMetadataCollector(), collection );
|
||||
indexComponent.setComponentClassName( component.getComponentClassName() );
|
||||
//TODO I don't know if this is appropriate
|
||||
indexComponent.setNodeName( "index" );
|
||||
while ( properties.hasNext() ) {
|
||||
Property current = (Property) properties.next();
|
||||
Property newProperty = new Property();
|
||||
|
@ -363,7 +361,6 @@ public class MapBinder extends CollectionBinder {
|
|||
newProperty.setUpdateable( false );
|
||||
newProperty.setMetaAttributes( current.getMetaAttributes() );
|
||||
newProperty.setName( current.getName() );
|
||||
newProperty.setNodeName( current.getNodeName() );
|
||||
newProperty.setNaturalIdentifier( false );
|
||||
//newProperty.setOptimisticLocked( false );
|
||||
newProperty.setOptional( false );
|
||||
|
|
|
@ -260,7 +260,6 @@ public class PropertyBinder {
|
|||
LOG.debugf( "Building property %s", name );
|
||||
Property prop = new Property();
|
||||
prop.setName( name );
|
||||
prop.setNodeName( name );
|
||||
prop.setValue( value );
|
||||
prop.setLazy( lazy );
|
||||
prop.setCascade( cascade );
|
||||
|
|
|
@ -54,8 +54,6 @@ public abstract class Collection implements Fetchable, Value, Filterable {
|
|||
private String manyToManyWhere;
|
||||
private String manyToManyOrderBy;
|
||||
private String referencedPropertyName;
|
||||
private String nodeName;
|
||||
private String elementNodeName;
|
||||
private String mappedByProperty;
|
||||
private boolean sorted;
|
||||
private Comparator comparator;
|
||||
|
@ -319,16 +317,6 @@ public abstract class Collection implements Fetchable, Value, Filterable {
|
|||
}
|
||||
|
||||
checkColumnDuplication();
|
||||
|
||||
if ( elementNodeName != null && elementNodeName.startsWith( "@" ) ) {
|
||||
throw new MappingException( "element node must not be an attribute: " + elementNodeName );
|
||||
}
|
||||
if ( elementNodeName != null && elementNodeName.equals( "." ) ) {
|
||||
throw new MappingException( "element node must not be the parent: " + elementNodeName );
|
||||
}
|
||||
if ( nodeName != null && nodeName.indexOf( '@' ) > -1 ) {
|
||||
throw new MappingException( "collection node must not be an attribute: " + elementNodeName );
|
||||
}
|
||||
}
|
||||
|
||||
private void checkColumnDuplication(java.util.Set distinctColumns, Iterator columns)
|
||||
|
@ -645,22 +633,6 @@ public abstract class Collection implements Fetchable, Value, Filterable {
|
|||
return ArrayHelper.EMPTY_BOOLEAN_ARRAY;
|
||||
}
|
||||
|
||||
public String getNodeName() {
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
public void setNodeName(String nodeName) {
|
||||
this.nodeName = nodeName;
|
||||
}
|
||||
|
||||
public String getElementNodeName() {
|
||||
return elementNodeName;
|
||||
}
|
||||
|
||||
public void setElementNodeName(String elementNodeName) {
|
||||
this.elementNodeName = elementNodeName;
|
||||
}
|
||||
|
||||
public boolean isSubselectLoadable() {
|
||||
return subselectLoadable;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ public class Component extends SimpleValue implements MetaAttributable {
|
|||
private PersistentClass owner;
|
||||
private boolean dynamic;
|
||||
private Map metaAttributes;
|
||||
private String nodeName;
|
||||
private boolean isKey;
|
||||
private String roleName;
|
||||
|
||||
|
@ -229,14 +228,6 @@ public class Component extends SimpleValue implements MetaAttributable {
|
|||
return result;
|
||||
}
|
||||
|
||||
public String getNodeName() {
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
public void setNodeName(String nodeName) {
|
||||
this.nodeName = nodeName;
|
||||
}
|
||||
|
||||
public boolean isKey() {
|
||||
return isKey;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ public abstract class IndexedCollection extends Collection {
|
|||
public static final String DEFAULT_INDEX_COLUMN_NAME = "idx";
|
||||
|
||||
private Value index;
|
||||
private String indexNodeName;
|
||||
|
||||
public IndexedCollection(MetadataImplementor metadata, PersistentClass owner) {
|
||||
super( metadata, owner );
|
||||
|
@ -84,22 +83,9 @@ public abstract class IndexedCollection extends Collection {
|
|||
getIndex().getType().getName()
|
||||
);
|
||||
}
|
||||
if ( indexNodeName!=null && !indexNodeName.startsWith("@") ) {
|
||||
throw new MappingException("index node must be an attribute: " + indexNodeName );
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isList() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getIndexNodeName() {
|
||||
return indexNodeName;
|
||||
}
|
||||
|
||||
public void setIndexNodeName(String indexNodeName) {
|
||||
this.indexNodeName = indexNodeName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -51,7 +51,6 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
private String proxyInterfaceName;
|
||||
private transient Class proxyInterface;
|
||||
|
||||
private String nodeName;
|
||||
private String jpaEntityName;
|
||||
|
||||
private String discriminatorValue;
|
||||
|
@ -815,14 +814,6 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
|
||||
public abstract Object accept(PersistentClassVisitor mv);
|
||||
|
||||
public String getNodeName() {
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
public void setNodeName(String nodeName) {
|
||||
this.nodeName = nodeName;
|
||||
}
|
||||
|
||||
public String getJpaEntityName() {
|
||||
return jpaEntityName;
|
||||
}
|
||||
|
@ -835,10 +826,6 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
return getClassName() != null;
|
||||
}
|
||||
|
||||
public boolean hasDom4jRepresentation() {
|
||||
return getNodeName() != null;
|
||||
}
|
||||
|
||||
public boolean hasSubselectLoadableCollections() {
|
||||
return hasSubselectLoadableCollections;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,6 @@ public class Property implements Serializable, MetaAttributable {
|
|||
private String propertyAccessorName;
|
||||
private boolean lazy;
|
||||
private boolean optional;
|
||||
private String nodeName;
|
||||
private java.util.Map metaAttributes;
|
||||
private PersistentClass persistentClass;
|
||||
private boolean naturalIdentifier;
|
||||
|
@ -291,14 +290,6 @@ public class Property implements Serializable, MetaAttributable {
|
|||
this.selectable = selectable;
|
||||
}
|
||||
|
||||
public String getNodeName() {
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
public void setNodeName(String nodeName) {
|
||||
this.nodeName = nodeName;
|
||||
}
|
||||
|
||||
public String getAccessorPropertyName( EntityMode mode ) {
|
||||
return getName();
|
||||
}
|
||||
|
|
|
@ -133,9 +133,6 @@ public abstract class AbstractCollectionPersister
|
|||
|
||||
private final int baseIndex;
|
||||
|
||||
private final String nodeName;
|
||||
private final String elementNodeName;
|
||||
private final String indexNodeName;
|
||||
private String mappedByProperty;
|
||||
|
||||
protected final boolean indexContainsFormula;
|
||||
|
@ -251,7 +248,6 @@ public abstract class AbstractCollectionPersister
|
|||
entityName = collectionBinding.getOwnerEntityName();
|
||||
ownerPersister = factory.getEntityPersister( entityName );
|
||||
queryLoaderName = collectionBinding.getLoaderName();
|
||||
nodeName = collectionBinding.getNodeName();
|
||||
isMutable = collectionBinding.isMutable();
|
||||
mappedByProperty = collectionBinding.getMappedByProperty();
|
||||
|
||||
|
@ -314,20 +310,15 @@ public abstract class AbstractCollectionPersister
|
|||
|
||||
// ELEMENT
|
||||
|
||||
String elemNode = collectionBinding.getElementNodeName();
|
||||
if ( elementType.isEntityType() ) {
|
||||
String entityName = ( (EntityType) elementType ).getAssociatedEntityName();
|
||||
elementPersister = factory.getEntityPersister( entityName );
|
||||
if ( elemNode == null ) {
|
||||
elemNode = creationContext.getMetadata().getEntityBinding( entityName ).getNodeName();
|
||||
}
|
||||
// NativeSQL: collect element column and auto-aliases
|
||||
|
||||
}
|
||||
else {
|
||||
elementPersister = null;
|
||||
}
|
||||
elementNodeName = elemNode;
|
||||
|
||||
int elementSpan = collectionBinding.getElement().getColumnSpan();
|
||||
elementColumnAliases = new String[elementSpan];
|
||||
|
@ -410,9 +401,6 @@ public abstract class AbstractCollectionPersister
|
|||
indexContainsFormula = hasFormula;
|
||||
baseIndex = indexedCollection.isList() ?
|
||||
( (List) indexedCollection ).getBaseIndex() : 0;
|
||||
|
||||
indexNodeName = indexedCollection.getIndexNodeName();
|
||||
|
||||
}
|
||||
else {
|
||||
indexContainsFormula = false;
|
||||
|
@ -423,7 +411,6 @@ public abstract class AbstractCollectionPersister
|
|||
indexColumnNames = null;
|
||||
indexColumnAliases = null;
|
||||
baseIndex = 0;
|
||||
indexNodeName = null;
|
||||
}
|
||||
|
||||
hasIdentifier = collectionBinding.isIdentified();
|
||||
|
@ -1834,21 +1821,6 @@ public abstract class AbstractCollectionPersister
|
|||
return isVersioned && getOwnerEntityPersister().isVersioned();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeName() {
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getElementNodeName() {
|
||||
return elementNodeName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIndexNodeName() {
|
||||
return indexNodeName;
|
||||
}
|
||||
|
||||
// TODO: deprecate???
|
||||
protected SQLExceptionConverter getSQLExceptionConverter() {
|
||||
return getSQLExceptionHelper().getSqlExceptionConverter();
|
||||
|
|
|
@ -262,12 +262,6 @@ public interface CollectionPersister extends CollectionDefinition {
|
|||
|
||||
//public boolean isSubselectLoadable();
|
||||
|
||||
public String getNodeName();
|
||||
|
||||
public String getElementNodeName();
|
||||
|
||||
public String getIndexNodeName();
|
||||
|
||||
public void postInstantiate() throws MappingException;
|
||||
|
||||
public SessionFactoryImplementor getFactory();
|
||||
|
|
|
@ -40,7 +40,6 @@ public class IdentifierProperty extends AbstractAttribute implements IdentifierA
|
|||
*/
|
||||
public IdentifierProperty(
|
||||
String name,
|
||||
String node,
|
||||
Type type,
|
||||
boolean embedded,
|
||||
IdentifierValue unsavedValue,
|
||||
|
|
|
@ -78,7 +78,6 @@ public final class PropertyFactory {
|
|||
else {
|
||||
return new IdentifierProperty(
|
||||
property.getName(),
|
||||
property.getNodeName(),
|
||||
type,
|
||||
mappedEntity.hasEmbeddedIdentifier(),
|
||||
unsavedValue,
|
||||
|
|
|
@ -780,18 +780,6 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver {
|
|||
return false; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
public String getNodeName() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
public String getElementNodeName() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
public String getIndexNodeName() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
public void postInstantiate() throws MappingException {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.MapKey;
|
||||
import javax.persistence.OneToMany;
|
||||
|
@ -37,6 +38,7 @@ import org.hibernate.envers.configuration.internal.metadata.MetadataTools;
|
|||
import org.hibernate.envers.internal.tools.MappingTools;
|
||||
import org.hibernate.envers.internal.tools.ReflectionTools;
|
||||
import org.hibernate.envers.internal.tools.StringTools;
|
||||
import org.hibernate.loader.PropertyPath;
|
||||
import org.hibernate.mapping.Component;
|
||||
import org.hibernate.mapping.Property;
|
||||
import org.hibernate.mapping.Value;
|
||||
|
@ -244,10 +246,8 @@ public class AuditedPropertiesReader {
|
|||
while ( propertyIter.hasNext() ) {
|
||||
final Property property = propertyIter.next();
|
||||
addPersistentProperty( property );
|
||||
if ( "embedded".equals( property.getPropertyAccessorName() )
|
||||
&& property.getName().equals( property.getNodeName() ) ) {
|
||||
// If property name equals node name and embedded accessor type is used, processing component
|
||||
// has been defined with <properties> tag. See HHH-6636 JIRA issue.
|
||||
// See HHH-6636
|
||||
if ( "embedded".equals( property.getPropertyAccessorName() ) && !PropertyPath.IDENTIFIER_MAPPER_PROPERTY.equals( property.getName() ) ) {
|
||||
createPropertiesGroupMapping( property );
|
||||
}
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ public class AuditedPropertiesReader {
|
|||
final Iterator<Property> componentProperties = component.getPropertyIterator();
|
||||
while ( componentProperties.hasNext() ) {
|
||||
final Property componentProperty = componentProperties.next();
|
||||
propertiesGroupMapping.put( componentProperty.getName(), component.getNodeName() );
|
||||
propertiesGroupMapping.put( componentProperty.getName(), property.getName() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue