DATACMNS-332 - AbstractMappingContext now prefers most concrete property.

BasicPersistentEntity now only caches the most concrete property for a by-name lookup to mimic the behavior that was implemented in getPersistentProperty(String name). This is to prevent shadowed properties of superclasses leaking into the by-name lookups.

Improved AbstractPersistentProperty.toString() to rather render the concrete field it is backed by.
This commit is contained in:
Oliver Gierke
2013-05-22 12:18:49 +02:00
parent 73b9d60be5
commit 24bc432d48
3 changed files with 26 additions and 2 deletions

View File

@@ -316,6 +316,6 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
*/
@Override
public String toString() {
return String.format("%s.%s : %s", getOwner().getType().getName(), getName(), getType().getName());
return this.field.toString();
}
}

View File

@@ -161,7 +161,10 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
Assert.notNull(property);
properties.add(property);
propertyCache.put(property.getName(), property);
if (!propertyCache.containsKey(property.getName())) {
propertyCache.put(property.getName(), property);
}
if (property.isIdProperty()) {