HHH-14149 Improve efficiency of LazyAttributesMetadata#getLazyAttributeNames
This commit is contained in:
parent
4957792ecd
commit
9ea3a936fb
|
@ -26,6 +26,7 @@ import org.hibernate.mapping.Property;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class LazyAttributesMetadata implements Serializable {
|
public class LazyAttributesMetadata implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a LazyFetchGroupMetadata based on the attributes defined for the
|
* Build a LazyFetchGroupMetadata based on the attributes defined for the
|
||||||
* PersistentClass
|
* PersistentClass
|
||||||
|
@ -83,6 +84,8 @@ public class LazyAttributesMetadata implements Serializable {
|
||||||
|
|
||||||
private final Map<String, LazyAttributeDescriptor> lazyAttributeDescriptorMap;
|
private final Map<String, LazyAttributeDescriptor> lazyAttributeDescriptorMap;
|
||||||
private final Map<String,Set<String>> fetchGroupToAttributeMap;
|
private final Map<String,Set<String>> fetchGroupToAttributeMap;
|
||||||
|
private final Set<String> fetchGroupNames;
|
||||||
|
private final Set<String> lazyAttributeNames;
|
||||||
|
|
||||||
public LazyAttributesMetadata(String entityName) {
|
public LazyAttributesMetadata(String entityName) {
|
||||||
this( entityName, Collections.emptyMap(), Collections.emptyMap() );
|
this( entityName, Collections.emptyMap(), Collections.emptyMap() );
|
||||||
|
@ -95,6 +98,8 @@ public class LazyAttributesMetadata implements Serializable {
|
||||||
this.entityName = entityName;
|
this.entityName = entityName;
|
||||||
this.lazyAttributeDescriptorMap = lazyAttributeDescriptorMap;
|
this.lazyAttributeDescriptorMap = lazyAttributeDescriptorMap;
|
||||||
this.fetchGroupToAttributeMap = fetchGroupToAttributeMap;
|
this.fetchGroupToAttributeMap = fetchGroupToAttributeMap;
|
||||||
|
this.fetchGroupNames = Collections.unmodifiableSet( fetchGroupToAttributeMap.keySet() );
|
||||||
|
this.lazyAttributeNames = Collections.unmodifiableSet( lazyAttributeDescriptorMap.keySet() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEntityName() {
|
public String getEntityName() {
|
||||||
|
@ -110,11 +115,14 @@ public class LazyAttributesMetadata implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getLazyAttributeNames() {
|
public Set<String> getLazyAttributeNames() {
|
||||||
return lazyAttributeDescriptorMap.keySet();
|
return lazyAttributeNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return an immutable set
|
||||||
|
*/
|
||||||
public Set<String> getFetchGroupNames() {
|
public Set<String> getFetchGroupNames() {
|
||||||
return fetchGroupToAttributeMap.keySet();
|
return fetchGroupNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLazyAttribute(String attributeName) {
|
public boolean isLazyAttribute(String attributeName) {
|
||||||
|
@ -137,6 +145,10 @@ public class LazyAttributesMetadata implements Serializable {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated This method is not being used and as such will be removed
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public Set<String> getAttributesInSameFetchGroup(String attributeName) {
|
public Set<String> getAttributesInSameFetchGroup(String attributeName) {
|
||||||
final String fetchGroupName = getFetchGroupName( attributeName );
|
final String fetchGroupName = getFetchGroupName( attributeName );
|
||||||
return getAttributesInFetchGroup( fetchGroupName );
|
return getAttributesInFetchGroup( fetchGroupName );
|
||||||
|
|
Loading…
Reference in New Issue