mirror of https://github.com/apache/openjpa.git
OPENJPA-2116: Optimize frequent operations a) field denotes a relation and b) schema name needs conversion.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1236326 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3929e28cda
commit
fc1ea49c38
|
@ -816,7 +816,7 @@ public class FetchConfigurationImpl
|
|||
if (!includes(fm))
|
||||
return FETCH_NONE;
|
||||
|
||||
Class<?> type = getRelationType(fm);
|
||||
Class<?> type = fm.getRelationType();
|
||||
if (type == null)
|
||||
return FETCH_LOAD;
|
||||
if (_availableDepth == 0)
|
||||
|
@ -842,7 +842,7 @@ public class FetchConfigurationImpl
|
|||
}
|
||||
|
||||
public FetchConfiguration traverse(FieldMetaData fm) {
|
||||
Class<?> type = getRelationType(fm);
|
||||
Class<?> type = fm.getRelationType();
|
||||
if (type == null)
|
||||
return this;
|
||||
|
||||
|
@ -943,18 +943,6 @@ public class FetchConfigurationImpl
|
|||
return Math.min(max, avail);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the relation type of the given field.
|
||||
*/
|
||||
private static Class<?> getRelationType(FieldMetaData fm) {
|
||||
if (fm.isDeclaredTypePC())
|
||||
return fm.getDeclaredType();
|
||||
if (fm.getElement().isDeclaredTypePC())
|
||||
return fm.getElement().getDeclaredType();
|
||||
if (fm.getKey().isDeclaredTypePC())
|
||||
return fm.getKey().getDeclaredType();
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduce the given logical depth by 1.
|
||||
|
|
|
@ -2390,5 +2390,19 @@ public class FieldMetaData
|
|||
public void setPersistentCollection(boolean persistentCollection) {
|
||||
_persistentCollection = persistentCollection;
|
||||
}
|
||||
|
||||
private Class<?> _relationType = Unknown.class;
|
||||
public Class<?> getRelationType() {
|
||||
if (_relationType == Unknown.class) {
|
||||
if (isDeclaredTypePC())
|
||||
_relationType = getDeclaredType();
|
||||
else if (getElement().isDeclaredTypePC())
|
||||
_relationType = getElement().getDeclaredType();
|
||||
else if (getKey().isDeclaredTypePC())
|
||||
_relationType = getKey().getDeclaredType();
|
||||
else
|
||||
_relationType = null;
|
||||
}
|
||||
return _relationType;
|
||||
}
|
||||
private class Unknown{};
|
||||
}
|
||||
|
|
|
@ -542,7 +542,8 @@ public class IdentifierUtilImpl implements IdentifierUtil, Configurable {
|
|||
|
||||
|
||||
protected boolean needsConversion(IdentifierConfiguration config) {
|
||||
return !(config.getConversionKey().equals(getIdentifierConfiguration().getConversionKey()));
|
||||
return (config != getIdentifierConfiguration())
|
||||
&& !(config.getConversionKey().equals(getIdentifierConfiguration().getConversionKey()));
|
||||
}
|
||||
|
||||
private IdentifierRule[] getNamingRules(String[] rules) {
|
||||
|
|
Loading…
Reference in New Issue