Merge branch 'master' into wip/EntityBeanIntercept-interface

This commit is contained in:
Rob Bygrave authored and GitHub committed 2022-04-13 10:43:13 +12:00
commit 9862526352
51 files changed
+230 -207

No files matched your search

@@ -524,7 +524,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
}
if (result instanceof BeanList) {
OrderBy<T> orderBy = query.getOrderBy();
if (orderBy != null) {
if (orderBy != null && !orderBy.isEmpty()) {
// in memory sort after merging the cache hits with the DB hits
beanDescriptor.sort(((BeanList<T>) result).getActualList(), orderBy.toStringFormat());
}
@@ -543,7 +543,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
@Override
public List<T> beanCacheHits() {
OrderBy<T> orderBy = query.getOrderBy();
if (orderBy != null) {
if (orderBy != null && !orderBy.isEmpty()) {
beanDescriptor.sort(cacheBeans, orderBy.toStringFormat());
}
return cacheBeans;
@@ -552,7 +552,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
@Override
public <K> Map<K, T> beanCacheHitsAsMap() {
OrderBy<T> orderBy = query.getOrderBy();
if (orderBy != null) {
if (orderBy != null && !orderBy.isEmpty()) {
beanDescriptor.sort(cacheBeans, orderBy.toStringFormat());
}
return cacheBeansToMap();
@@ -7,12 +7,14 @@ import javax.persistence.DiscriminatorType;
import java.sql.Types;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
/**
* Represents a node in the Inheritance tree.
* Holds information regarding Super Subclass support.
*/
public final class DeployInheritInfo {
public final class DeployInheritInfo implements Comparable<DeployInheritInfo> {
/**
* the default discriminator column according to the JPA 1.0 spec.
@@ -27,7 +29,7 @@ public final class DeployInheritInfo {
private String columnDefn;
private final Class<?> type;
private Class<?> parent;
private final ArrayList<DeployInheritInfo> children = new ArrayList<>();
private final Set<DeployInheritInfo> children = new TreeSet<>();
/**
* Create for a given type.
@@ -74,7 +76,7 @@ public final class DeployInheritInfo {
/**
* Return the child nodes.
*/
public List<DeployInheritInfo> children() {
public Set<DeployInheritInfo> children() {
return children;
}
@@ -251,7 +253,22 @@ public final class DeployInheritInfo {
@Override
public String toString() {
return "InheritInfo[" + type.getName() + "]" + " root[" + parent.getName() + "]" + " disValue[" + discriminatorStringValue + "]";
String root = parent == null ? null : parent.getName();
String name = type == null ? null : type.getName();
return "InheritInfo[" + name + "]" + " root[" + root + "]" + " disValue[" + discriminatorStringValue + "]";
}
@Override
public int compareTo(DeployInheritInfo o) {
if (o == this || o.discriminatorStringValue == null && discriminatorStringValue == null) {
return 0;
} else if (o.discriminatorStringValue == null) {
return 1;
} else if (discriminatorStringValue == null) {
return -1;
} else {
return discriminatorStringValue.compareTo(o.discriminatorStringValue);
}
}
}