mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ec425928b | ||
|
|
711701932a | ||
|
|
951e517caf | ||
|
|
8cef603d1c | ||
|
|
2a64a02211 | ||
|
|
67ef0cd5d9 | ||
|
|
9f2334362a |
@@ -9,7 +9,7 @@
|
||||
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean</artifactId>
|
||||
<version>10.2.2</version>
|
||||
<version>10.2.3</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>ebean</name>
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<scm>
|
||||
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
|
||||
<tag>ebean-10.2.2</tag>
|
||||
<tag>ebean-10.2.3</tag>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -185,30 +185,33 @@ public abstract class AbstractNamingConvention implements NamingConvention {
|
||||
*/
|
||||
@Override
|
||||
public TableName getTableName(Class<?> beanClass) {
|
||||
while (true) {
|
||||
|
||||
TableName tableName = getTableNameFromAnnotation(beanClass);
|
||||
if (tableName == null) {
|
||||
Class<?> supCls = beanClass.getSuperclass();
|
||||
if (hasInheritance(supCls)) {
|
||||
// get the table as per inherited class in case there
|
||||
// is not a table annotation in the inheritance hierarchy
|
||||
return getTableName(supCls);
|
||||
TableName tableName = getTableNameFromAnnotation(beanClass);
|
||||
if (tableName == null) {
|
||||
Class<?> supCls = beanClass.getSuperclass();
|
||||
if (hasInheritance(supCls)) {
|
||||
// get the table as per inherited class in case there
|
||||
// is not a table annotation in the inheritance hierarchy
|
||||
beanClass = supCls;
|
||||
continue;
|
||||
}
|
||||
|
||||
tableName = getTableNameByConvention(beanClass);
|
||||
}
|
||||
|
||||
tableName = getTableNameByConvention(beanClass);
|
||||
// Use naming convention for catalog or schema,
|
||||
// if not set in the annotation.
|
||||
String catalog = tableName.getCatalog();
|
||||
if (isEmpty(catalog)) {
|
||||
catalog = getCatalog();
|
||||
}
|
||||
String schema = tableName.getSchema();
|
||||
if (isEmpty(schema)) {
|
||||
schema = getSchema();
|
||||
}
|
||||
return new TableName(catalog, schema, tableName.getName());
|
||||
}
|
||||
|
||||
// Use naming convention for catalog or schema,
|
||||
// if not set in the annotation.
|
||||
String catalog = tableName.getCatalog();
|
||||
if (isEmpty(catalog)) {
|
||||
catalog = getCatalog();
|
||||
}
|
||||
String schema = tableName.getSchema();
|
||||
if (isEmpty(schema)) {
|
||||
schema = getSchema();
|
||||
}
|
||||
return new TableName(catalog, schema, tableName.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -271,14 +274,16 @@ public abstract class AbstractNamingConvention implements NamingConvention {
|
||||
* Search recursively for an @Table in the class hierarchy.
|
||||
*/
|
||||
protected Table findTableAnnotation(Class<?> cls) {
|
||||
if (cls.equals(Object.class)) {
|
||||
return null;
|
||||
while (true) {
|
||||
if (cls.equals(Object.class)) {
|
||||
return null;
|
||||
}
|
||||
Table table = cls.getAnnotation(Table.class);
|
||||
if (table != null) {
|
||||
return table;
|
||||
}
|
||||
cls = cls.getSuperclass();
|
||||
}
|
||||
Table table = cls.getAnnotation(Table.class);
|
||||
if (table != null) {
|
||||
return table;
|
||||
}
|
||||
return findTableAnnotation(cls.getSuperclass());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,42 +48,44 @@ public class StringHelper {
|
||||
*/
|
||||
private static HashMap<String, String> parseNameQuotedValue(HashMap<String, String> map,
|
||||
String tag, int pos) throws RuntimeException {
|
||||
while (true) {
|
||||
|
||||
int equalsPos = tag.indexOf('=', pos);
|
||||
if (equalsPos > -1) {
|
||||
// check for begin quote...
|
||||
char firstQuote = tag.charAt(equalsPos + 1);
|
||||
if (firstQuote != SINGLE_QUOTE && firstQuote != DOUBLE_QUOTE) {
|
||||
throw new RuntimeException("missing begin quote at " + (equalsPos) + "["
|
||||
+ tag.charAt(equalsPos + 1) + "] in [" + tag + "]");
|
||||
int equalsPos = tag.indexOf('=', pos);
|
||||
if (equalsPos > -1) {
|
||||
// check for begin quote...
|
||||
char firstQuote = tag.charAt(equalsPos + 1);
|
||||
if (firstQuote != SINGLE_QUOTE && firstQuote != DOUBLE_QUOTE) {
|
||||
throw new RuntimeException("missing begin quote at " + (equalsPos) + "["
|
||||
+ tag.charAt(equalsPos + 1) + "] in [" + tag + "]");
|
||||
}
|
||||
|
||||
// check for end quote...
|
||||
int endQuotePos = tag.indexOf(firstQuote, equalsPos + 2);
|
||||
if (endQuotePos == -1) {
|
||||
throw new RuntimeException("missing end quote [" + firstQuote + "] after " + pos + " in [" + tag + "]");
|
||||
}
|
||||
|
||||
// we have a valid name and value...
|
||||
// dp("pos="+pos+" equalsPos="+equalsPos+"
|
||||
// endQuotePos="+endQuotePos);
|
||||
String name = tag.substring(pos, equalsPos);
|
||||
// dp("name="+name+"; value="+value+";");
|
||||
|
||||
// trim off any whitespace from the front of name...
|
||||
name = trimFront(name, " ");
|
||||
if ((name.indexOf(SINGLE_QUOTE) > -1) || (name.indexOf(DOUBLE_QUOTE) > -1)) {
|
||||
throw new RuntimeException("attribute name contains a quote [" + name + "]");
|
||||
}
|
||||
|
||||
String value = tag.substring(equalsPos + 2, endQuotePos);
|
||||
map.put(name, value);
|
||||
|
||||
pos = endQuotePos + 1;
|
||||
|
||||
} else {
|
||||
// no more equals... stop parsing...
|
||||
return map;
|
||||
}
|
||||
|
||||
// check for end quote...
|
||||
int endQuotePos = tag.indexOf(firstQuote, equalsPos + 2);
|
||||
if (endQuotePos == -1) {
|
||||
throw new RuntimeException("missing end quote [" + firstQuote + "] after " + pos + " in [" + tag + "]");
|
||||
}
|
||||
|
||||
// we have a valid name and value...
|
||||
// dp("pos="+pos+" equalsPos="+equalsPos+"
|
||||
// endQuotePos="+endQuotePos);
|
||||
String name = tag.substring(pos, equalsPos);
|
||||
// dp("name="+name+"; value="+value+";");
|
||||
|
||||
// trim off any whitespace from the front of name...
|
||||
name = trimFront(name, " ");
|
||||
if ((name.indexOf(SINGLE_QUOTE) > -1) || (name.indexOf(DOUBLE_QUOTE) > -1)) {
|
||||
throw new RuntimeException("attribute name contains a quote [" + name + "]");
|
||||
}
|
||||
|
||||
String value = tag.substring(equalsPos + 2, endQuotePos);
|
||||
map.put(name, value);
|
||||
|
||||
return parseNameQuotedValue(map, tag, endQuotePos + 1);
|
||||
|
||||
} else {
|
||||
// no more equals... stop parsing...
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,14 +98,15 @@ public class StringHelper {
|
||||
}
|
||||
|
||||
private static int countOccurances(String content, String occurs, int pos, int countSoFar) {
|
||||
int equalsPos = content.indexOf(occurs, pos);
|
||||
if (equalsPos > -1) {
|
||||
countSoFar += 1;
|
||||
pos = equalsPos + occurs.length();
|
||||
// dp("countSoFar="+countSoFar+" pos="+pos);
|
||||
return countOccurances(content, occurs, pos, countSoFar);
|
||||
} else {
|
||||
return countSoFar;
|
||||
while (true) {
|
||||
int equalsPos = content.indexOf(occurs, pos);
|
||||
if (equalsPos > -1) {
|
||||
countSoFar += 1;
|
||||
pos = equalsPos + occurs.length();
|
||||
// dp("countSoFar="+countSoFar+" pos="+pos);
|
||||
} else {
|
||||
return countSoFar;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,14 +138,16 @@ public class StringHelper {
|
||||
* @param trim the string to trim off the front
|
||||
*/
|
||||
public static String trimFront(String source, String trim) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
if (source.indexOf(trim) == 0) {
|
||||
// dp("trim ...");
|
||||
return trimFront(source.substring(trim.length()), trim);
|
||||
} else {
|
||||
return source;
|
||||
while (true) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
if (source.indexOf(trim) == 0) {
|
||||
// dp("trim ...");
|
||||
source = source.substring(trim.length());
|
||||
} else {
|
||||
return source;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,55 +163,57 @@ public class StringHelper {
|
||||
*/
|
||||
private static HashMap<String, String> getKeyValue(HashMap<String, String> map, int pos,
|
||||
String allNameValuePairs, String listDelimiter, String nameValueSeparator) {
|
||||
while (true) {
|
||||
|
||||
if (pos >= allNameValuePairs.length()) {
|
||||
// dp("end as "+pos+" >= "+allNameValuePairs.length() );
|
||||
return map;
|
||||
}
|
||||
|
||||
int equalsPos = allNameValuePairs.indexOf(nameValueSeparator, pos);
|
||||
int delimPos = allNameValuePairs.indexOf(listDelimiter, pos);
|
||||
|
||||
if (delimPos == -1) {
|
||||
delimPos = allNameValuePairs.length();
|
||||
}
|
||||
if (equalsPos == -1) {
|
||||
// dp("no more equals...");
|
||||
return map;
|
||||
}
|
||||
if (delimPos == (equalsPos + 1)) {
|
||||
// dp("Ignoring as nothing between delim and equals...
|
||||
// delim:"+delimPos+" eq:"+equalsPos);
|
||||
return getKeyValue(map, delimPos + 1, allNameValuePairs, listDelimiter,
|
||||
nameValueSeparator);
|
||||
}
|
||||
if (equalsPos > delimPos) {
|
||||
// there is a key without a value?
|
||||
String key = allNameValuePairs.substring(pos, delimPos);
|
||||
key = key.trim();
|
||||
if (!key.isEmpty()) {
|
||||
map.put(key, null);
|
||||
if (pos >= allNameValuePairs.length()) {
|
||||
// dp("end as "+pos+" >= "+allNameValuePairs.length() );
|
||||
return map;
|
||||
}
|
||||
return getKeyValue(map, delimPos + 1, allNameValuePairs, listDelimiter,
|
||||
nameValueSeparator);
|
||||
|
||||
}
|
||||
String key = allNameValuePairs.substring(pos, equalsPos);
|
||||
int equalsPos = allNameValuePairs.indexOf(nameValueSeparator, pos);
|
||||
int delimPos = allNameValuePairs.indexOf(listDelimiter, pos);
|
||||
|
||||
if (delimPos > -1) {
|
||||
String value = allNameValuePairs.substring(equalsPos + 1, delimPos);
|
||||
// dp("cont "+key+","+value+" pos:"+pos+"
|
||||
// len:"+allNameValuePairs.length());
|
||||
key = key.trim();
|
||||
if (delimPos == -1) {
|
||||
delimPos = allNameValuePairs.length();
|
||||
}
|
||||
if (equalsPos == -1) {
|
||||
// dp("no more equals...");
|
||||
return map;
|
||||
}
|
||||
if (delimPos == (equalsPos + 1)) {
|
||||
// dp("Ignoring as nothing between delim and equals...
|
||||
// delim:"+delimPos+" eq:"+equalsPos);
|
||||
pos = delimPos + 1;
|
||||
continue;
|
||||
}
|
||||
if (equalsPos > delimPos) {
|
||||
// there is a key without a value?
|
||||
String key = allNameValuePairs.substring(pos, delimPos);
|
||||
key = key.trim();
|
||||
if (!key.isEmpty()) {
|
||||
map.put(key, null);
|
||||
}
|
||||
pos = delimPos + 1;
|
||||
continue;
|
||||
|
||||
map.put(key, value);
|
||||
pos = delimPos + 1;
|
||||
}
|
||||
String key = allNameValuePairs.substring(pos, equalsPos);
|
||||
|
||||
// recurse the rest of the values...
|
||||
return getKeyValue(map, pos, allNameValuePairs, listDelimiter, nameValueSeparator);
|
||||
} else {
|
||||
// dp("ERROR: delimPos < 0 ???");
|
||||
return map;
|
||||
if (delimPos > -1) {
|
||||
String value = allNameValuePairs.substring(equalsPos + 1, delimPos);
|
||||
// dp("cont "+key+","+value+" pos:"+pos+"
|
||||
// len:"+allNameValuePairs.length());
|
||||
key = key.trim();
|
||||
|
||||
map.put(key, value);
|
||||
pos = delimPos + 1;
|
||||
|
||||
// recurse the rest of the values...
|
||||
|
||||
} else {
|
||||
// dp("ERROR: delimPos < 0 ???");
|
||||
return map;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1726,15 +1726,19 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
* account inheritance.
|
||||
*/
|
||||
public BeanProperty getBeanPropertyFromPath(String path) {
|
||||
BeanDescriptor other = this;
|
||||
while (true) {
|
||||
|
||||
String[] split = SplitName.splitBegin(path);
|
||||
if (split[1] == null) {
|
||||
return _findBeanProperty(split[0]);
|
||||
String[] split = SplitName.splitBegin(path);
|
||||
if (split[1] == null) {
|
||||
return other._findBeanProperty(split[0]);
|
||||
}
|
||||
BeanPropertyAssoc<?> assocProp = (BeanPropertyAssoc<?>) other._findBeanProperty(split[0]);
|
||||
BeanDescriptor<?> targetDesc = assocProp.getTargetDescriptor();
|
||||
|
||||
path = split[1];
|
||||
other = targetDesc;
|
||||
}
|
||||
BeanPropertyAssoc<?> assocProp = (BeanPropertyAssoc<?>) _findBeanProperty(split[0]);
|
||||
BeanDescriptor<?> targetDesc = assocProp.getTargetDescriptor();
|
||||
|
||||
return targetDesc.getBeanPropertyFromPath(split[1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1746,18 +1750,22 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
* Return the BeanDescriptor for a given path of Associated One or Many beans.
|
||||
*/
|
||||
public BeanDescriptor<?> getBeanDescriptor(String path) {
|
||||
if (path == null) {
|
||||
return this;
|
||||
}
|
||||
String[] splitBegin = SplitName.splitBegin(path);
|
||||
BeanDescriptor result = this;
|
||||
while (true) {
|
||||
if (path == null) {
|
||||
return result;
|
||||
}
|
||||
String[] splitBegin = SplitName.splitBegin(path);
|
||||
|
||||
BeanProperty beanProperty = findBeanProperty(splitBegin[0]);
|
||||
if (beanProperty instanceof BeanPropertyAssoc<?>) {
|
||||
BeanPropertyAssoc<?> assocProp = (BeanPropertyAssoc<?>) beanProperty;
|
||||
return assocProp.getTargetDescriptor().getBeanDescriptor(splitBegin[1]);
|
||||
BeanProperty beanProperty = result.findBeanProperty(splitBegin[0]);
|
||||
if (beanProperty instanceof BeanPropertyAssoc<?>) {
|
||||
BeanPropertyAssoc<?> assocProp = (BeanPropertyAssoc<?>) beanProperty;
|
||||
path = splitBegin[1];
|
||||
result = assocProp.getTargetDescriptor();
|
||||
|
||||
} else {
|
||||
throw new PersistenceException("Invalid path " + path + " from " + getFullName());
|
||||
} else {
|
||||
throw new PersistenceException("Invalid path " + path + " from " + result.getFullName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1777,13 +1785,17 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
* </p>
|
||||
*/
|
||||
public BeanPropertyAssocOne<?> getUnidirectional() {
|
||||
if (unidirectional != null) {
|
||||
return unidirectional;
|
||||
BeanDescriptor other = this;
|
||||
while (true) {
|
||||
if (other.unidirectional != null) {
|
||||
return other.unidirectional;
|
||||
}
|
||||
if (other.inheritInfo != null && !other.inheritInfo.isRoot()) {
|
||||
other = other.inheritInfo.getParent().desc();
|
||||
continue;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (inheritInfo != null && !inheritInfo.isRoot()) {
|
||||
return inheritInfo.getParent().desc().getUnidirectional();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,41 +36,43 @@ public final class DeployUpdateParser extends DeployParser {
|
||||
}
|
||||
|
||||
private String convertSubword(int start, String currentWord, StringBuilder localBuffer) {
|
||||
while (true) {
|
||||
|
||||
int dotPos = currentWord.indexOf('.', start);
|
||||
if (start == 0 && dotPos == -1) {
|
||||
return currentWord;
|
||||
}
|
||||
if (start == 0) {
|
||||
localBuffer = new StringBuilder();
|
||||
}
|
||||
if (dotPos == -1) {
|
||||
// no match...
|
||||
localBuffer.append(currentWord.substring(start));
|
||||
return localBuffer.toString();
|
||||
}
|
||||
int dotPos = currentWord.indexOf('.', start);
|
||||
if (start == 0 && dotPos == -1) {
|
||||
return currentWord;
|
||||
}
|
||||
if (start == 0) {
|
||||
localBuffer = new StringBuilder();
|
||||
}
|
||||
if (dotPos == -1) {
|
||||
// no match...
|
||||
localBuffer.append(currentWord.substring(start));
|
||||
return localBuffer.toString();
|
||||
}
|
||||
|
||||
// append up to the dot
|
||||
localBuffer.append(currentWord.substring(start, dotPos + 1));
|
||||
// append up to the dot
|
||||
localBuffer.append(currentWord.substring(start, dotPos + 1));
|
||||
|
||||
if (dotPos == currentWord.length() - 1) {
|
||||
// ends with a "." ???
|
||||
return localBuffer.toString();
|
||||
}
|
||||
if (dotPos == currentWord.length() - 1) {
|
||||
// ends with a "." ???
|
||||
return localBuffer.toString();
|
||||
}
|
||||
|
||||
// get the remainder after the dot
|
||||
start = dotPos + 1;
|
||||
String remainder = currentWord.substring(start, currentWord.length());
|
||||
// get the remainder after the dot
|
||||
start = dotPos + 1;
|
||||
String remainder = currentWord.substring(start, currentWord.length());
|
||||
|
||||
//String dbWord = deployMap.get(remainder.toLowerCase());
|
||||
String dbWord = getDeployWord(remainder);
|
||||
if (dbWord != null) {
|
||||
// we have found a match for the remainder
|
||||
localBuffer.append(dbWord);
|
||||
return localBuffer.toString();
|
||||
} else {
|
||||
//
|
||||
return convertSubword(start, currentWord, localBuffer);
|
||||
//String dbWord = deployMap.get(remainder.toLowerCase());
|
||||
String dbWord = getDeployWord(remainder);
|
||||
if (dbWord != null) {
|
||||
// we have found a match for the remainder
|
||||
localBuffer.append(dbWord);
|
||||
return localBuffer.toString();
|
||||
} else {
|
||||
//
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,18 +79,22 @@ class DetermineAggPath {
|
||||
}
|
||||
|
||||
String getManyPath(int pos, DeployBeanDescriptor<?> desc) {
|
||||
while (true) {
|
||||
|
||||
String path = paths[pos];
|
||||
DeployBeanProperty details = desc.getBeanProperty(path);
|
||||
if (details instanceof DeployBeanPropertyAssocMany<?>) {
|
||||
return path(pos);
|
||||
String path = paths[pos];
|
||||
DeployBeanProperty details = desc.getBeanProperty(path);
|
||||
if (details instanceof DeployBeanPropertyAssocMany<?>) {
|
||||
return path(pos);
|
||||
|
||||
} else if (details instanceof DeployBeanPropertyAssocOne<?>) {
|
||||
DeployBeanPropertyAssocOne<?> one = (DeployBeanPropertyAssocOne<?>) details;
|
||||
DeployBeanDescriptor<?> targetDesc = one.getTargetDeploy();
|
||||
return getManyPath(pos + 1, targetDesc);
|
||||
} else if (details instanceof DeployBeanPropertyAssocOne<?>) {
|
||||
DeployBeanPropertyAssocOne<?> one = (DeployBeanPropertyAssocOne<?>) details;
|
||||
DeployBeanDescriptor<?> targetDesc = one.getTargetDeploy();
|
||||
desc = targetDesc;
|
||||
pos = pos + 1;
|
||||
continue;
|
||||
}
|
||||
throw new IllegalArgumentException("Can not find path to many in aggregation formula [" + aggregation + "]");
|
||||
}
|
||||
throw new IllegalArgumentException("Can not find path to many in aggregation formula [" + aggregation + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,15 +146,17 @@ public class DeployInherit {
|
||||
}
|
||||
|
||||
private boolean isInheritanceClass(Class<?> cls) {
|
||||
if (cls.equals(Object.class)) {
|
||||
return false;
|
||||
while (true) {
|
||||
if (cls.equals(Object.class)) {
|
||||
return false;
|
||||
}
|
||||
Annotation a = AnnotationBase.findAnnotation(cls, Inheritance.class);
|
||||
if (a != null) {
|
||||
return true;
|
||||
}
|
||||
// search up the inheritance heirarchy
|
||||
cls = cls.getSuperclass();
|
||||
}
|
||||
Annotation a = AnnotationBase.findAnnotation(cls, Inheritance.class);
|
||||
if (a != null) {
|
||||
return true;
|
||||
}
|
||||
// search up the inheritance heirarchy
|
||||
return isInheritanceClass(cls.getSuperclass());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class CQueryFetchSingleAttribute {
|
||||
|
||||
private int rowCount;
|
||||
|
||||
private final ScalarType<Object> scalarType;
|
||||
private final ScalarType<?> scalarType;
|
||||
|
||||
/**
|
||||
* Create the Sql select based on the request.
|
||||
@@ -65,7 +65,7 @@ class CQueryFetchSingleAttribute {
|
||||
this.sql = plan.getSql();
|
||||
this.desc = request.getBeanDescriptor();
|
||||
this.predicates = predicates;
|
||||
this.scalarType = plan.getSingleProperty().getScalarType();
|
||||
this.scalarType = plan.getSingleAttributeScalarType();
|
||||
|
||||
query.setGeneratedSql(sql);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import io.ebeaninternal.server.query.CQueryPlanStats.Snapshot;
|
||||
import io.ebeaninternal.server.type.DataBind;
|
||||
import io.ebeaninternal.server.type.DataReader;
|
||||
import io.ebeaninternal.server.type.RsetDataReader;
|
||||
import io.ebeaninternal.server.type.ScalarType;
|
||||
import io.ebeaninternal.server.util.Md5;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -248,7 +249,7 @@ public class CQueryPlan {
|
||||
return stats.getLastQueryTime();
|
||||
}
|
||||
|
||||
BeanProperty getSingleProperty() {
|
||||
return sqlTree.getRootNode().getSingleProperty();
|
||||
ScalarType<?> getSingleAttributeScalarType() {
|
||||
return sqlTree.getRootNode().getSingleAttributeScalarType();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -674,28 +674,31 @@ public final class SqlTreeBuilder {
|
||||
*/
|
||||
private SqlTreeNodeExtraJoin findExtraJoinRoot(String includeProp,
|
||||
SqlTreeNodeExtraJoin childJoin) {
|
||||
while (true) {
|
||||
|
||||
int dotPos = includeProp.lastIndexOf('.');
|
||||
if (dotPos == -1) {
|
||||
// no parent possible(parent is root)
|
||||
return childJoin;
|
||||
|
||||
} else {
|
||||
// look in register ...
|
||||
String parentPropertyName = includeProp.substring(0, dotPos);
|
||||
if (selectIncludes.contains(parentPropertyName)) {
|
||||
// parent already handled by select
|
||||
int dotPos = includeProp.lastIndexOf('.');
|
||||
if (dotPos == -1) {
|
||||
// no parent possible(parent is root)
|
||||
return childJoin;
|
||||
}
|
||||
|
||||
SqlTreeNodeExtraJoin parentJoin = joinRegister.get(parentPropertyName);
|
||||
if (parentJoin == null) {
|
||||
// we need to create this the parent implicitly...
|
||||
parentJoin = createJoinLeaf(parentPropertyName);
|
||||
}
|
||||
} else {
|
||||
// look in register ...
|
||||
String parentPropertyName = includeProp.substring(0, dotPos);
|
||||
if (selectIncludes.contains(parentPropertyName)) {
|
||||
// parent already handled by select
|
||||
return childJoin;
|
||||
}
|
||||
|
||||
parentJoin.addChild(childJoin);
|
||||
return findExtraJoinRoot(parentPropertyName, parentJoin);
|
||||
SqlTreeNodeExtraJoin parentJoin = joinRegister.get(parentPropertyName);
|
||||
if (parentJoin == null) {
|
||||
// we need to create this the parent implicitly...
|
||||
parentJoin = createJoinLeaf(parentPropertyName);
|
||||
}
|
||||
|
||||
parentJoin.addChild(childJoin);
|
||||
childJoin = parentJoin;
|
||||
includeProp = parentPropertyName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ package io.ebeaninternal.server.query;
|
||||
import io.ebean.Version;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.server.deploy.BeanProperty;
|
||||
import io.ebeaninternal.server.deploy.DbReadContext;
|
||||
import io.ebeaninternal.server.deploy.DbSqlContext;
|
||||
import io.ebeaninternal.server.type.ScalarType;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
@@ -81,6 +81,6 @@ interface SqlTreeNode {
|
||||
/**
|
||||
* Return the property for singleAttribute query.
|
||||
*/
|
||||
BeanProperty getSingleProperty();
|
||||
ScalarType<?> getSingleAttributeScalarType();
|
||||
|
||||
}
|
||||
|
||||
@@ -11,12 +11,14 @@ import io.ebeaninternal.api.SpiQuery.Mode;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.deploy.BeanProperty;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssoc;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocOne;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
import io.ebeaninternal.server.deploy.DbReadContext;
|
||||
import io.ebeaninternal.server.deploy.DbSqlContext;
|
||||
import io.ebeaninternal.server.deploy.InheritInfo;
|
||||
import io.ebeaninternal.server.deploy.TableJoin;
|
||||
import io.ebeaninternal.server.deploy.id.IdBinder;
|
||||
import io.ebeaninternal.server.type.ScalarType;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
@@ -58,7 +60,7 @@ class SqlTreeNodeBean implements SqlTreeNode {
|
||||
* False if report bean and has no id property.
|
||||
*/
|
||||
protected final boolean readId;
|
||||
|
||||
|
||||
private final boolean disableLazyLoad;
|
||||
|
||||
protected final InheritInfo inheritInfo;
|
||||
@@ -134,13 +136,19 @@ class SqlTreeNodeBean implements SqlTreeNode {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanProperty getSingleProperty() {
|
||||
public ScalarType<?> getSingleAttributeScalarType() {
|
||||
if (properties == null || properties.length == 0) {
|
||||
// if we have no property ask first children (in a distinct select with join)
|
||||
// if we have also no children, NPE happens anyway.
|
||||
return children[0].getSingleProperty();
|
||||
return children[0].getSingleAttributeScalarType();
|
||||
}
|
||||
return properties[0];
|
||||
if (properties[0] instanceof BeanPropertyAssocOne<?>) {
|
||||
BeanPropertyAssocOne assocOne = (BeanPropertyAssocOne<?>)properties[0];
|
||||
if (assocOne.isAssocId()) {
|
||||
return assocOne.getTargetDescriptor().getIdProperty().getScalarType();
|
||||
}
|
||||
}
|
||||
return properties[0].getScalarType();
|
||||
}
|
||||
|
||||
private Map<String, String> createPathMap(String prefix, BeanDescriptor<?> desc) {
|
||||
|
||||
@@ -3,12 +3,12 @@ package io.ebeaninternal.server.query;
|
||||
import io.ebean.Version;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.server.deploy.BeanProperty;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssoc;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
import io.ebeaninternal.server.deploy.DbReadContext;
|
||||
import io.ebeaninternal.server.deploy.DbSqlContext;
|
||||
import io.ebeaninternal.server.deploy.TableJoin;
|
||||
import io.ebeaninternal.server.type.ScalarType;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
@@ -72,7 +72,7 @@ class SqlTreeNodeExtraJoin implements SqlTreeNode {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanProperty getSingleProperty() {
|
||||
public ScalarType<?> getSingleAttributeScalarType() {
|
||||
throw new IllegalStateException("No expected");
|
||||
}
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@ package io.ebeaninternal.server.query;
|
||||
import io.ebean.Version;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.server.deploy.BeanProperty;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssoc;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocOne;
|
||||
import io.ebeaninternal.server.deploy.DbReadContext;
|
||||
import io.ebeaninternal.server.deploy.DbSqlContext;
|
||||
import io.ebeaninternal.server.deploy.TableJoin;
|
||||
import io.ebeaninternal.server.type.ScalarType;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
@@ -41,7 +41,7 @@ class SqlTreeNodeManyWhereJoin implements SqlTreeNode {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanProperty getSingleProperty() {
|
||||
public ScalarType<?> getSingleAttributeScalarType() {
|
||||
throw new IllegalStateException("No expected");
|
||||
}
|
||||
|
||||
|
||||
@@ -961,7 +961,7 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
if (isNativeSql()) {
|
||||
queryPlanKey = new NativeSqlQueryPlanKey(nativeSql);
|
||||
} else {
|
||||
queryPlanKey = new OrmQueryPlanKey(m2mIncludeJoin, type, detail, maxRows, firstRow,
|
||||
queryPlanKey = new OrmQueryPlanKey(beanDescriptor.getDiscValue(), m2mIncludeJoin, type, detail, maxRows, firstRow,
|
||||
disableLazyLoading, orderBy,
|
||||
distinct, sqlDistinct, mapKey, id, bindParams, whereExpressions, havingExpressions,
|
||||
temporalMode, forUpdate, rootTableAlias, rawSql, updateProperties);
|
||||
|
||||
@@ -26,7 +26,7 @@ class OrmQueryPlanKey implements CQueryPlanKey {
|
||||
private final int bindCount;
|
||||
private final String options;
|
||||
|
||||
OrmQueryPlanKey(TableJoin m2mIncludeTable, SpiQuery.Type type, OrmQueryDetail detail, int maxRows, int firstRow, boolean disableLazyLoading,
|
||||
OrmQueryPlanKey(String discValue, TableJoin m2mIncludeTable, SpiQuery.Type type, OrmQueryDetail detail, int maxRows, int firstRow, boolean disableLazyLoading,
|
||||
OrderBy<?> orderBy, boolean distinct, boolean sqlDistinct, String mapKey, Object id, BindParams bindParams,
|
||||
SpiExpression whereExpressions, SpiExpression havingExpressions, SpiQuery.TemporalMode temporalMode,
|
||||
Query.ForUpdate forUpdate, String rootTableAlias, RawSql rawSql, OrmUpdateProperties updateProperties) {
|
||||
@@ -35,6 +35,9 @@ class OrmQueryPlanKey implements CQueryPlanKey {
|
||||
if (type != null) {
|
||||
sb.append("t:").append(type.ordinal());
|
||||
}
|
||||
if (discValue != null) {
|
||||
sb.append("disc:").append(discValue);
|
||||
}
|
||||
if (temporalMode != SpiQuery.TemporalMode.CURRENT) {
|
||||
sb.append(",temp:").append(temporalMode.ordinal());
|
||||
}
|
||||
|
||||
@@ -17,11 +17,14 @@ public class TypeReflectHelper {
|
||||
|
||||
public static Class<?> getClass(Type type) {
|
||||
|
||||
if (type instanceof ParameterizedType) {
|
||||
return getClass(((ParameterizedType) type).getRawType());
|
||||
}
|
||||
while (true) {
|
||||
if (type instanceof ParameterizedType) {
|
||||
type = ((ParameterizedType) type).getRawType();
|
||||
continue;
|
||||
}
|
||||
|
||||
return (Class<?>) type;
|
||||
return (Class<?>) type;
|
||||
}
|
||||
}
|
||||
|
||||
private static Type[] getParamType(Class<?> cls, Class<?> matchRawType) {
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package io.ebean;
|
||||
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.EbeanServer;
|
||||
import io.ebean.Transaction;
|
||||
import org.tests.model.basic.EBasicVer;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package io.ebean;
|
||||
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.EbeanServer;
|
||||
import io.ebean.Transaction;
|
||||
import org.tests.model.basic.EBasicVer;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package io.ebean;
|
||||
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.EbeanServer;
|
||||
import io.ebean.Transaction;
|
||||
import org.tests.model.basic.EBasicVer;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ebean;
|
||||
|
||||
import org.tests.model.basic.EBasicVer;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -2,7 +2,7 @@ package io.ebean;
|
||||
|
||||
import io.ebean.bean.EntityBean;
|
||||
import org.tests.model.converstation.User;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -8,7 +8,7 @@ import io.ebean.common.BeanList;
|
||||
import io.ebean.config.ServerConfig;
|
||||
import org.tests.model.basic.EBasic;
|
||||
import org.tests.model.basic.ECustomId;
|
||||
import org.example.ModUuidGenerator;
|
||||
import org.tests.example.ModUuidGenerator;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -22,19 +22,29 @@ public class OrmQueryPlanKeyTest extends BaseExpressionTest {
|
||||
@Test
|
||||
public void equals_when_defaults() {
|
||||
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
|
||||
assertSame(key1, key2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equals_when_diffDiscValue() {
|
||||
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey("A", null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key3 = new OrmQueryPlanKey("B", null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertDifferent(key1, key2);
|
||||
assertDifferent(key2, key3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equals_when_diffTableJoinNull() {
|
||||
|
||||
TableJoin tableJoin = tableJoin("table", "id", "customer_id");
|
||||
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(tableJoin, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, tableJoin, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
@@ -45,8 +55,8 @@ public class OrmQueryPlanKeyTest extends BaseExpressionTest {
|
||||
TableJoin tableJoin1 = tableJoin("one", "id", "customer_id");
|
||||
TableJoin tableJoin2 = tableJoin("two", "id", "customer_id");
|
||||
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(tableJoin1, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(tableJoin2, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, tableJoin1, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, tableJoin2, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
@@ -57,8 +67,8 @@ public class OrmQueryPlanKeyTest extends BaseExpressionTest {
|
||||
TableJoin tableJoin1 = tableJoin("one", "id", "customer_id");
|
||||
TableJoin tableJoin2 = tableJoin("one", "id", "customer_id");
|
||||
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(tableJoin1, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(tableJoin2, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, tableJoin1, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, tableJoin2, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
|
||||
assertSame(key1, key2);
|
||||
}
|
||||
@@ -74,8 +84,8 @@ public class OrmQueryPlanKeyTest extends BaseExpressionTest {
|
||||
@Test
|
||||
public void equals_when_diffQueryType() {
|
||||
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.LIST, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.LIST, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
@@ -83,8 +93,8 @@ public class OrmQueryPlanKeyTest extends BaseExpressionTest {
|
||||
@Test
|
||||
public void equals_when_firstRowsDifferent() {
|
||||
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 10, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 10, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
@@ -92,8 +102,8 @@ public class OrmQueryPlanKeyTest extends BaseExpressionTest {
|
||||
@Test
|
||||
public void equals_when_maxRowsDifferent() {
|
||||
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 10, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 10, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
@@ -101,8 +111,8 @@ public class OrmQueryPlanKeyTest extends BaseExpressionTest {
|
||||
@Test
|
||||
public void equals_when_firstRowsMaxRowsSame() {
|
||||
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 10, 20, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 10, 20, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 10, 20, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 10, 20, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
|
||||
assertSame(key1, key2);
|
||||
}
|
||||
@@ -110,8 +120,8 @@ public class OrmQueryPlanKeyTest extends BaseExpressionTest {
|
||||
@Test
|
||||
public void equals_when_diffDisableLazyLoading() {
|
||||
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, true, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, true, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
@@ -120,8 +130,8 @@ public class OrmQueryPlanKeyTest extends BaseExpressionTest {
|
||||
public void equals_when_diffOrderByNull() {
|
||||
|
||||
OrderBy<Object> o1 = new OrderBy<>("id");
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, o1, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, o1, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
@@ -131,121 +141,121 @@ public class OrmQueryPlanKeyTest extends BaseExpressionTest {
|
||||
|
||||
OrderBy<Object> o1 = new OrderBy<>("id, name");
|
||||
OrderBy<Object> o2 = new OrderBy<>("id, name");
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, o1, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, o2, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, o1, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, o2, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
|
||||
assertSame(key1, key2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equals_when_diffDistinct() {
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, true, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, true, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equals_when_sameDistinct() {
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, true, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, true, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, true, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, true, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertSame(key1, key2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equals_when_diffSqlDistinct() {
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, true, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, true, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equals_when_sameSqlDistinct() {
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, true, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, true, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, true, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, true, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertSame(key1, key2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equals_when_diffMapKeyNull() {
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, "mapKey", null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, "mapKey", null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equals_when_diffMapKey() {
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, "mapKey", null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, "diff", null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, "mapKey", null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, "diff", null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equals_when_sameMapKey() {
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, "mapKey", null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, "mapKey", null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, "mapKey", null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, "mapKey", null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertSame(key1, key2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equals_when_diffIdNull() {
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, 42, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, 42, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equals_when_idBothGiven() {
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, 42, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, 23, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, 42, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, 23, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertSame(key1, key2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equals_when_diffTemporalMode() {
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.DRAFT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.DRAFT, null, null, null, null);
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equals_when_diffForUpdate() {
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, Query.ForUpdate.BASE, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, Query.ForUpdate.BASE, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equals_when_diffForUpdate_NoWait() {
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, Query.ForUpdate.BASE, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, Query.ForUpdate.NOWAIT, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, Query.ForUpdate.BASE, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, Query.ForUpdate.NOWAIT, null, null, null);
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equals_when_diffForUpdate_SkipLocked() {
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, Query.ForUpdate.BASE, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, Query.ForUpdate.SKIPLOCKED, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, Query.ForUpdate.BASE, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, Query.ForUpdate.SKIPLOCKED, null, null, null);
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equals_when_diffRootAliasNull() {
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, "rootAlias", null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, "rootAlias", null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equals_when_diffRootAlias() {
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, "rootAlias", null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, "diff", null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, "rootAlias", null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, "diff", null, null);
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equals_when_sameRootAlias() {
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, "rootAlias", null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, "rootAlias", null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, "rootAlias", null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, "rootAlias", null, null);
|
||||
assertSame(key1, key2);
|
||||
}
|
||||
|
||||
@@ -272,8 +282,8 @@ public class OrmQueryPlanKeyTest extends BaseExpressionTest {
|
||||
SpiExpressionList<Customer> list1 = list_id_eq_42();
|
||||
SpiExpressionList<Customer> list2 = list_id_eq_43();
|
||||
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, list1, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, list2, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, list1, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, list2, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertSame(key1, key2);
|
||||
}
|
||||
|
||||
@@ -284,8 +294,8 @@ public class OrmQueryPlanKeyTest extends BaseExpressionTest {
|
||||
SpiExpressionList<Customer> where1 = list_id_eq_42();
|
||||
SpiExpressionList<Customer> where2 = list_id_eq_42_and_name_eq_rob();
|
||||
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, where1, null, SpiQuery.TemporalMode.DRAFT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, where2, null, SpiQuery.TemporalMode.DRAFT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, where1, null, SpiQuery.TemporalMode.DRAFT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, where2, null, SpiQuery.TemporalMode.DRAFT, null, null, null, null);
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
|
||||
@@ -294,8 +304,8 @@ public class OrmQueryPlanKeyTest extends BaseExpressionTest {
|
||||
|
||||
SpiExpressionList<Customer> list1 = list_id_eq_42();
|
||||
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, list1, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, list1, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
|
||||
@@ -304,8 +314,8 @@ public class OrmQueryPlanKeyTest extends BaseExpressionTest {
|
||||
|
||||
SpiExpressionList<Customer> list1 = list_id_eq_42();
|
||||
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, list1, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, list1, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
|
||||
@@ -315,8 +325,8 @@ public class OrmQueryPlanKeyTest extends BaseExpressionTest {
|
||||
SpiExpression having1 = list_id_eq_42().copyForPlanKey();
|
||||
SpiExpression having2 = list_id_eq_42_and_name_eq_rob().copyForPlanKey();
|
||||
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, having1, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, having2, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, having1, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, having2, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
|
||||
@@ -326,8 +336,8 @@ public class OrmQueryPlanKeyTest extends BaseExpressionTest {
|
||||
SpiExpression having1 = list_id_eq_42().copyForPlanKey();
|
||||
SpiExpression having2 = list_id_eq_42().copyForPlanKey();
|
||||
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, having1, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, having2, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, having1, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, having2, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertSame(key1, key2);
|
||||
}
|
||||
|
||||
@@ -336,8 +346,8 @@ public class OrmQueryPlanKeyTest extends BaseExpressionTest {
|
||||
|
||||
SpiExpression having1 = list_id_eq_42().copyForPlanKey();
|
||||
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, having1, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, having1, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
|
||||
@@ -346,8 +356,8 @@ public class OrmQueryPlanKeyTest extends BaseExpressionTest {
|
||||
|
||||
SpiExpression having1 = list_id_eq_42().copyForPlanKey();
|
||||
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, having1, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key1 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, null, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
OrmQueryPlanKey key2 = new OrmQueryPlanKey(null, null, SpiQuery.Type.BEAN, null, 0, 0, false, null, false, false, null, null, null, null, having1, SpiQuery.TemporalMode.CURRENT, null, null, null, null);
|
||||
assertDifferent(key1, key2);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.avaje.ebeantest;
|
||||
package org.ebeantest;
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
import ch.qos.logback.classic.Logger;
|
||||
@@ -13,7 +13,7 @@ import io.ebeaninternal.server.autotune.service.TunedQueryInfo;
|
||||
import io.ebeaninternal.server.querydefn.OrmQueryDetail;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -9,7 +9,7 @@ import io.ebean.bean.EntityBeanIntercept;
|
||||
import org.tests.model.basic.Address;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import io.ebean.Update;
|
||||
import io.ebean.config.dbplatform.DbEncrypt;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import org.tests.model.basic.EBasicEncrypt;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.ebean.Ebean;
|
||||
import io.ebean.EbeanServer;
|
||||
import io.ebean.Query;
|
||||
import org.tests.model.basic.EBasicClobFetchEager;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.ebean.Ebean;
|
||||
import io.ebean.EbeanServer;
|
||||
import io.ebean.Query;
|
||||
import org.tests.model.basic.EBasicClobNoVer;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.ebean.Ebean;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.PersistBatch;
|
||||
import org.tests.model.basic.OCachedBean;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.ebean.cache.ServerCache;
|
||||
import io.ebean.cache.ServerCacheManager;
|
||||
import io.ebean.cache.ServerCacheStatistics;
|
||||
import org.tests.model.basic.UUOne;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.ebean.Ebean;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.OrderDetail;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.ebean.FetchConfig;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.OrderDetail;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -8,7 +8,7 @@ import io.ebeaninternal.api.SpiQuery;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package org.tests.cache;
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import org.tests.model.basic.OCachedBean;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.ebean.Ebean;
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import org.tests.model.basic.TSDetail;
|
||||
import org.tests.model.basic.TSMaster;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -7,7 +7,7 @@ import io.ebean.Query;
|
||||
import org.tests.model.basic.Contact;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -7,7 +7,7 @@ import io.ebean.Query;
|
||||
import org.tests.model.draftable.Doc;
|
||||
import org.tests.model.draftable.Link;
|
||||
import org.assertj.core.api.StrictAssertions;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.example;
|
||||
package org.tests.example;
|
||||
|
||||
import io.ebean.config.IdGenerator;
|
||||
import org.avaje.moduuid.ModUUID;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.avaje.test.model.rawsql.inherit;
|
||||
package org.tests.inherit;
|
||||
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
import javax.persistence.Entity;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.avaje.test.model.rawsql.inherit;
|
||||
package org.tests.inherit;
|
||||
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
import javax.persistence.Entity;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.avaje.test.model.rawsql.inherit;
|
||||
package org.tests.inherit;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.avaje.test.model.rawsql.inherit;
|
||||
package org.tests.inherit;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.avaje.test.model.rawsql.inherit;
|
||||
package org.tests.inherit;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.DiscriminatorColumn;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.avaje.test.model.rawsql.inherit;
|
||||
package org.tests.inherit;
|
||||
|
||||
import io.ebean.annotation.Sql;
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.tests.inheritance;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.EbeanServer;
|
||||
import org.junit.Test;
|
||||
import org.tests.inheritance.model.GroupConfiguration;
|
||||
import org.tests.inheritance.model.ProductConfiguration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TestInheritanceDiscriminatorQueryCache extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void testDiscriminatorQueryCache() {
|
||||
EbeanServer server = Ebean.getDefaultServer();
|
||||
|
||||
ProductConfiguration pc1 = new ProductConfiguration();
|
||||
pc1.setName("PC1");
|
||||
server.save(pc1);
|
||||
|
||||
ProductConfiguration pc2 = new ProductConfiguration();
|
||||
pc1.setName("PC2");
|
||||
server.save(pc2);
|
||||
|
||||
GroupConfiguration gc1 = new GroupConfiguration();
|
||||
gc1.setName("GC1");
|
||||
server.save(gc1);
|
||||
|
||||
GroupConfiguration gc2 = new GroupConfiguration();
|
||||
gc1.setName("GC2");
|
||||
server.save(gc2);
|
||||
|
||||
List<ProductConfiguration> list1 = server.createQuery(ProductConfiguration.class).setUseQueryCache(true).findList();
|
||||
List<GroupConfiguration> list2 = server.createQuery(GroupConfiguration.class).setUseQueryCache(true).findList();
|
||||
|
||||
for(ProductConfiguration pc : list1) {
|
||||
System.out.print(pc.getProductName());
|
||||
}
|
||||
for(GroupConfiguration gc : list2) {
|
||||
System.out.print(gc.getGroupName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,10 +3,10 @@ package org.tests.inheritance;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.avaje.test.model.rawsql.inherit.ChildA;
|
||||
import org.avaje.test.model.rawsql.inherit.ChildB;
|
||||
import org.avaje.test.model.rawsql.inherit.Parent;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.tests.inherit.ChildA;
|
||||
import org.tests.inherit.ChildB;
|
||||
import org.tests.inherit.Parent;
|
||||
import org.junit.Test;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
@@ -17,24 +17,24 @@ public class TestInheritanceRefBean extends BaseTestCase {
|
||||
public void test() {
|
||||
Parent a = new ChildA(42, "Bean A");
|
||||
Parent b = new ChildB(43, "Bean B");
|
||||
|
||||
|
||||
server().save(a);
|
||||
server().save(b);
|
||||
Long idA = a.getId();
|
||||
Long idB = b.getId();
|
||||
|
||||
|
||||
Parent test;
|
||||
|
||||
|
||||
LoggedSqlCollector.start();
|
||||
test = server().getReference(ChildA.class, idA);
|
||||
assertTrue(test instanceof ChildA);
|
||||
assertEquals(0, LoggedSqlCollector.stop().size());
|
||||
|
||||
|
||||
LoggedSqlCollector.start();
|
||||
test = server().getReference(Parent.class, idB);
|
||||
assertTrue(test instanceof ChildB);
|
||||
assertEquals(1, LoggedSqlCollector.stop().size());
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
package org.tests.inheritance.model;
|
||||
|
||||
import io.ebean.annotation.Cache;
|
||||
import io.ebean.annotation.ChangeLog;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.DiscriminatorColumn;
|
||||
import javax.persistence.DiscriminatorType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.*;
|
||||
|
||||
@ChangeLog
|
||||
@Entity
|
||||
@Cache(enableQueryCache = true)
|
||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||
@DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING)
|
||||
public class Configuration extends AbstractBaseClass {
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import org.tests.model.json.EBasicJsonList;
|
||||
import org.tests.model.json.PlainBean;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -3,7 +3,7 @@ package org.tests.model.array;
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.Query;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
@@ -3,7 +3,7 @@ package org.tests.model.array;
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.Query;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.PersistBatch;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.PersistBatch;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.PersistBatch;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -2,7 +2,7 @@ package org.tests.model.embedded;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.tests.model.onetoone;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.EbeanServer;
|
||||
import io.ebean.Transaction;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -2,7 +2,7 @@ package org.tests.model.onetoone.album;
|
||||
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.ebean.Ebean;
|
||||
import io.ebean.PagedList;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.ebean.FetchConfig;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.OrderShipment;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.ebean.Ebean;
|
||||
import io.ebean.PagedList;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.ebean.FetchConfig;
|
||||
import io.ebean.Query;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.ebean.Query;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.OrderDetail;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.Query;
|
||||
import org.tests.model.converstation.Conversation;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.ebean.Ebean;
|
||||
import io.ebean.Query;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.ebean.Ebean;
|
||||
import io.ebean.Query;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ import io.ebean.Query;
|
||||
import org.tests.model.basic.Contact;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.avaje.test.model.rawsql.inherit.ChildA;
|
||||
import org.avaje.test.model.rawsql.inherit.Data;
|
||||
import org.avaje.test.model.rawsql.inherit.EUncle;
|
||||
import org.tests.inherit.ChildA;
|
||||
import org.tests.inherit.Data;
|
||||
import org.tests.inherit.EUncle;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -299,4 +299,35 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
+ "join rawinherit_parent_rawinherit_data t1 on t0.id = t1.rawinherit_data_id "
|
||||
+ "join parent t2 on t1.rawinherit_parent_id = t2.id");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void distinctWithOrderByPk() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
Query<Contact> query = Ebean.find(Contact.class)
|
||||
.setDistinct(true)
|
||||
.select("customer")
|
||||
.orderBy().desc("customer");
|
||||
|
||||
query.findSingleAttributeList();
|
||||
|
||||
assertThat(sqlOf(query)).contains("select distinct t0.customer_id from contact t0 order by t0.customer_id desc");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void distinctWithCascadedFetchOrderByPk() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
Query<Contact> query = Ebean.find(Contact.class)
|
||||
.setDistinct(true)
|
||||
.fetch("customer","billingAddress")
|
||||
.orderBy().desc("customer.billingAddress");
|
||||
|
||||
query.findSingleAttributeList();
|
||||
|
||||
assertThat(sqlOf(query)).contains("select distinct t1.billing_address_id from contact t0 join o_customer t1 on t1.id = t0.customer_id order by t1.billing_address_id desc");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.ebean.Ebean;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.PagedList;
|
||||
import org.tests.model.onetoone.album.Cover;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.ebean.SqlQuery;
|
||||
import io.ebean.SqlRow;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -2,10 +2,10 @@ package org.tests.rawsql.inherit;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import org.avaje.test.model.rawsql.inherit.ChildA;
|
||||
import org.avaje.test.model.rawsql.inherit.ChildB;
|
||||
import org.avaje.test.model.rawsql.inherit.Data;
|
||||
import org.avaje.test.model.rawsql.inherit.Parent;
|
||||
import org.tests.inherit.ChildA;
|
||||
import org.tests.inherit.ChildB;
|
||||
import org.tests.inherit.Data;
|
||||
import org.tests.inherit.Parent;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -5,12 +5,12 @@ import io.ebean.Ebean;
|
||||
import io.ebean.FetchConfig;
|
||||
import io.ebean.RawSql;
|
||||
import io.ebean.RawSqlBuilder;
|
||||
import org.avaje.test.model.rawsql.inherit.ChildA;
|
||||
import org.avaje.test.model.rawsql.inherit.ChildB;
|
||||
import org.avaje.test.model.rawsql.inherit.Data;
|
||||
import org.avaje.test.model.rawsql.inherit.EUncle;
|
||||
import org.avaje.test.model.rawsql.inherit.Parent;
|
||||
import org.avaje.test.model.rawsql.inherit.ParentAggregate;
|
||||
import org.tests.inherit.ChildA;
|
||||
import org.tests.inherit.ChildB;
|
||||
import org.tests.inherit.Data;
|
||||
import org.tests.inherit.EUncle;
|
||||
import org.tests.inherit.Parent;
|
||||
import org.tests.inherit.ParentAggregate;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -13,7 +13,7 @@ import io.ebean.event.readaudit.ReadEvent;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import org.tests.model.basic.Country;
|
||||
import org.tests.model.basic.EBasicChangeLog;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -7,7 +7,7 @@ import io.ebean.SqlQuery;
|
||||
import io.ebean.SqlRow;
|
||||
import org.tests.model.softdelete.EBasicSDChild;
|
||||
import org.tests.model.softdelete.EBasicSoftDelete;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import org.tests.model.softdelete.ESoftDelRole;
|
||||
import org.tests.model.softdelete.ESoftDelUser;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.avaje.test.model.inheritmany.test;
|
||||
package org.tests.test;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
@@ -7,7 +7,7 @@ import io.ebean.Transaction;
|
||||
import io.ebean.PersistBatch;
|
||||
import org.tests.model.basic.UTDetail;
|
||||
import org.tests.model.basic.UTMaster;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.ebean.Ebean;
|
||||
import io.ebean.Transaction;
|
||||
import org.tests.model.m2m.MnyB;
|
||||
import org.tests.model.m2m.MnyC;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import org.tests.model.json.EBasicHstore;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.ebean.Ebean;
|
||||
import io.ebean.EbeanServer;
|
||||
import io.ebean.Transaction;
|
||||
import org.tests.model.basic.EBasicVer;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
Reference in New Issue
Block a user