mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Refactor FetchConfig
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean api</name>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
<!-- <parent>-->
|
||||
<!-- <groupId>org.avaje</groupId>-->
|
||||
@@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
+5
-5
@@ -30,7 +30,7 @@ public class ProfileOriginTest extends BaseTestCase {
|
||||
|
||||
OrmQueryDetail detail = po.buildDetail(desc);
|
||||
|
||||
assertThat(detail.asString().trim()).isEqualTo("fetch customer (name)");
|
||||
assertThat(detail.asStringDebug().trim()).isEqualTo("fetch customer (name)");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -49,7 +49,7 @@ public class ProfileOriginTest extends BaseTestCase {
|
||||
|
||||
OrmQueryDetail detail = po.buildDetail(desc);
|
||||
|
||||
assertThat(detail.asString()).isEqualTo("select (orderDate) fetch customer (name)");
|
||||
assertThat(detail.asStringDebug()).isEqualTo("select (orderDate) fetch customer (name)");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -67,7 +67,7 @@ public class ProfileOriginTest extends BaseTestCase {
|
||||
|
||||
OrmQueryDetail detail = po.buildDetail(desc);
|
||||
|
||||
assertThat(detail.asString().trim()).isEqualTo("select (orderDate,customer)");
|
||||
assertThat(detail.asStringDebug().trim()).isEqualTo("select (orderDate,customer)");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -90,7 +90,7 @@ public class ProfileOriginTest extends BaseTestCase {
|
||||
|
||||
OrmQueryDetail detail = po.buildDetail(desc);
|
||||
|
||||
assertThat(detail.asString()).isEqualTo("select (orderDate) fetch customer (billingAddress)");
|
||||
assertThat(detail.asStringDebug()).isEqualTo("select (orderDate) fetch customer (billingAddress)");
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ public class ProfileOriginTest extends BaseTestCase {
|
||||
po.collectUsageInfo(c);
|
||||
|
||||
OrmQueryDetail detail = po.buildDetail(desc);
|
||||
assertThat(detail.asString()).isEqualTo("fetch customer (name,note) fetch customer.billingAddress (line1)");
|
||||
assertThat(detail.asStringDebug()).isEqualTo("fetch customer (name,note) fetch customer.billingAddress (line1)");
|
||||
}
|
||||
|
||||
private NodeUsageCollector node(String path) {
|
||||
|
||||
+15
-15
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean bom</name>
|
||||
@@ -81,88 +81,88 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-xml</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-autotune</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>kotlin-querybean-generator</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgis</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-redis</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
@@ -21,7 +21,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
+4
-4
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core</artifactId>
|
||||
@@ -92,19 +92,19 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
+8
-5
@@ -5,7 +5,6 @@ import io.ebean.annotation.FetchPreference;
|
||||
import io.ebean.annotation.HistoryExclude;
|
||||
import io.ebean.annotation.Where;
|
||||
import io.ebean.bean.BeanCollection.ModifyListenMode;
|
||||
import io.ebean.config.BeanNotRegisteredException;
|
||||
import io.ebean.config.NamingConvention;
|
||||
import io.ebean.config.TableName;
|
||||
import io.ebean.core.type.ScalarType;
|
||||
@@ -140,15 +139,15 @@ class AnnotationAssocManys extends AnnotationAssoc {
|
||||
JoinTable joinTable = get(prop, JoinTable.class);
|
||||
if (joinTable != null) {
|
||||
if (prop.isManyToMany()) {
|
||||
// expected this
|
||||
readJoinTable(joinTable, prop);
|
||||
|
||||
} else {
|
||||
// OneToMany with @JoinTable
|
||||
prop.setO2mJoinTable();
|
||||
readJoinTable(joinTable, prop);
|
||||
manyToManyDefaultJoins(prop);
|
||||
}
|
||||
} else if (prop.isManyToMany()) {
|
||||
checkSelfManyToMany(prop);
|
||||
}
|
||||
|
||||
if (prop.getMappedBy() != null) {
|
||||
@@ -181,6 +180,12 @@ class AnnotationAssocManys extends AnnotationAssoc {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkSelfManyToMany(DeployBeanPropertyAssocMany<?> prop) {
|
||||
if (prop.getTargetType().equals(descriptor.getBeanType())) {
|
||||
throw new IllegalStateException("@ManyToMany mapping for " + prop.getFullBeanName() + " requires explicit @JoinTable with joinColumns & inverseJoinColumns. Refer issue #2157");
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void readElementCollection(DeployBeanPropertyAssocMany<?> prop, ElementCollection elementCollection) {
|
||||
|
||||
@@ -430,7 +435,6 @@ class AnnotationAssocManys extends AnnotationAssoc {
|
||||
}
|
||||
|
||||
private void readToMany(ManyToMany propAnn, DeployBeanPropertyAssocMany<?> manyProp) {
|
||||
|
||||
manyProp.setMappedBy(propAnn.mappedBy());
|
||||
manyProp.setFetchType(propAnn.fetch());
|
||||
setCascadeTypes(propAnn.cascade(), manyProp.getCascadeInfo());
|
||||
@@ -442,7 +446,6 @@ class AnnotationAssocManys extends AnnotationAssoc {
|
||||
}
|
||||
|
||||
private void readToOne(OneToMany propAnn, DeployBeanPropertyAssocMany<?> manyProp) {
|
||||
|
||||
manyProp.setMappedBy(propAnn.mappedBy());
|
||||
manyProp.setFetchType(propAnn.fetch());
|
||||
setCascadeTypes(propAnn.cascade(), manyProp.getCascadeInfo());
|
||||
|
||||
@@ -1136,81 +1136,81 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
private String planDescription() {
|
||||
StringBuilder sb = new StringBuilder(300);
|
||||
if (type != null) {
|
||||
sb.append("t:").append(type.ordinal());
|
||||
sb.append(type.ordinal());
|
||||
}
|
||||
if (useDocStore) {
|
||||
sb.append(",ds:");
|
||||
sb.append("/ds");
|
||||
}
|
||||
if (beanDescriptor.getDiscValue() != null) {
|
||||
sb.append(",disc:").append(beanDescriptor.getDiscValue());
|
||||
sb.append("/dv").append(beanDescriptor.getDiscValue());
|
||||
}
|
||||
if (temporalMode != SpiQuery.TemporalMode.CURRENT) {
|
||||
sb.append(",temp:").append(temporalMode.ordinal());
|
||||
sb.append("/tm").append(temporalMode.ordinal());
|
||||
if (versionsStart != null) {
|
||||
sb.append(",vb:");
|
||||
sb.append("v");
|
||||
}
|
||||
}
|
||||
if (forUpdate != null) {
|
||||
sb.append(",forUpd:").append(forUpdate.ordinal());
|
||||
sb.append("/fu").append(forUpdate.ordinal());
|
||||
if (lockType != null) {
|
||||
sb.append(",lt:").append(lockType.ordinal());
|
||||
sb.append("t").append(lockType.ordinal());
|
||||
}
|
||||
}
|
||||
if (id != null) {
|
||||
sb.append(",id:");
|
||||
sb.append("/id");
|
||||
}
|
||||
if (manualId) {
|
||||
sb.append(",manId:");
|
||||
sb.append("/md");
|
||||
}
|
||||
if (distinct) {
|
||||
sb.append(",dist:");
|
||||
sb.append("/dt");
|
||||
}
|
||||
if (allowLoadErrors) {
|
||||
sb.append(",allowLoadErrors:");
|
||||
sb.append("/ae");
|
||||
}
|
||||
if (disableLazyLoading) {
|
||||
sb.append(",disLazy:");
|
||||
sb.append("/dl");
|
||||
}
|
||||
if (baseTable != null) {
|
||||
sb.append(",baseTable:").append(baseTable);
|
||||
sb.append("/bt").append(baseTable);
|
||||
}
|
||||
if (rootTableAlias != null) {
|
||||
sb.append(",root:").append(rootTableAlias);
|
||||
sb.append("/ra").append(rootTableAlias);
|
||||
}
|
||||
if (orderBy != null) {
|
||||
sb.append(",orderBy:").append(orderBy.toStringFormat());
|
||||
sb.append("/ob").append(orderBy.toStringFormat());
|
||||
}
|
||||
if (m2mIncludeJoin != null) {
|
||||
sb.append(",m2m:").append(m2mIncludeJoin.getTable());
|
||||
sb.append("/m2").append(m2mIncludeJoin.getTable());
|
||||
}
|
||||
if (mapKey != null) {
|
||||
sb.append(",mapKey:").append(mapKey);
|
||||
sb.append("/mk").append(mapKey);
|
||||
}
|
||||
if (countDistinctOrder != null) {
|
||||
sb.append(",countDistOrd:").append(countDistinctOrder.name());
|
||||
sb.append("/cd").append(countDistinctOrder.name());
|
||||
}
|
||||
if (detail != null) {
|
||||
sb.append(" detail[");
|
||||
sb.append("/d[");
|
||||
detail.queryPlanHash(sb);
|
||||
sb.append("]");
|
||||
}
|
||||
if (bindParams != null) {
|
||||
sb.append(" bindParams[");
|
||||
sb.append("/b[");
|
||||
bindParams.buildQueryPlanHash(sb);
|
||||
sb.append("]");
|
||||
}
|
||||
if (whereExpressions != null) {
|
||||
sb.append(" where[");
|
||||
sb.append("/w[");
|
||||
whereExpressions.queryPlanHash(sb);
|
||||
sb.append("]");
|
||||
}
|
||||
if (havingExpressions != null) {
|
||||
sb.append(" having[");
|
||||
sb.append("/h[");
|
||||
havingExpressions.queryPlanHash(sb);
|
||||
sb.append("]");
|
||||
}
|
||||
if (updateProperties != null) {
|
||||
sb.append(" update[");
|
||||
sb.append("/u[");
|
||||
updateProperties.buildQueryPlanHash(sb);
|
||||
sb.append("]");
|
||||
}
|
||||
|
||||
@@ -106,15 +106,10 @@ public class OrmQueryDetail implements Serializable {
|
||||
return p1 == null ? p2 == null : p1.isSameByAutoTune(p2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return asString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the detail in string form.
|
||||
*/
|
||||
public String asString() {
|
||||
public String asStringDebug() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (!baseProps.isEmpty()) {
|
||||
baseProps.asStringDebug("select ", sb);
|
||||
@@ -150,7 +145,7 @@ public class OrmQueryDetail implements Serializable {
|
||||
* Set the base query properties to be empty.
|
||||
*/
|
||||
public void setEmptyBase() {
|
||||
this.baseProps = new OrmQueryProperties(null, new LinkedHashSet<>());
|
||||
this.baseProps = new OrmQueryProperties(null, Collections.emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -316,7 +311,7 @@ public class OrmQueryDetail implements Serializable {
|
||||
if (addId) {
|
||||
parentProp = new OrmQueryProperties(parentPath, assocOne.getTargetIdProperty());
|
||||
} else {
|
||||
parentProp = new OrmQueryProperties(parentPath, new LinkedHashSet<>());
|
||||
parentProp = new OrmQueryProperties(parentPath, Collections.emptySet());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class OrmQueryPlanKey implements CQueryPlanKey {
|
||||
|
||||
@Override
|
||||
public CQueryPlanKey withDeleteByIds() {
|
||||
return new OrmQueryPlanKey(description + ":deleteByIds", 0, 0, null);
|
||||
return new OrmQueryPlanKey(description + "/deleteByIds", 0, 0, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+41
-106
@@ -3,8 +3,8 @@ package io.ebeaninternal.server.querydefn;
|
||||
import io.ebean.FetchConfig;
|
||||
import io.ebeaninternal.server.util.DSelectColumnsParser;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Parses the path properties string.
|
||||
@@ -22,9 +22,9 @@ class OrmQueryPropertiesParser {
|
||||
final boolean cache;
|
||||
final FetchConfig fetchConfig;
|
||||
final String properties;
|
||||
final LinkedHashSet<String> included;
|
||||
final Set<String> included;
|
||||
|
||||
Response(boolean readOnly, boolean cache, int queryFetchBatch, int lazyFetchBatch, String properties, LinkedHashSet<String> included) {
|
||||
Response(boolean readOnly, boolean cache, int queryFetchBatch, int lazyFetchBatch, String properties, Set<String> included) {
|
||||
this.readOnly = readOnly;
|
||||
this.cache = cache;
|
||||
this.properties = properties;
|
||||
@@ -55,9 +55,7 @@ class OrmQueryPropertiesParser {
|
||||
return new OrmQueryPropertiesParser(rawProperties).parse();
|
||||
}
|
||||
|
||||
private String inputProperties;
|
||||
|
||||
private String outputProperties = "";
|
||||
private final String inputProperties;
|
||||
private boolean allProperties;
|
||||
private boolean readOnly;
|
||||
private boolean cache;
|
||||
@@ -72,124 +70,61 @@ class OrmQueryPropertiesParser {
|
||||
* Parse the raw string properties input.
|
||||
*/
|
||||
private Response parse() {
|
||||
|
||||
if (inputProperties == null || inputProperties.isEmpty()) {
|
||||
return EMPTY;
|
||||
}
|
||||
int pos = inputProperties.indexOf("+readonly");
|
||||
if (pos > -1) {
|
||||
inputProperties = inputProperties.replace("+readonly", "");
|
||||
readOnly = true;
|
||||
}
|
||||
pos = inputProperties.indexOf("+cache");
|
||||
if (pos > -1) {
|
||||
inputProperties = inputProperties.replace("+cache", "");
|
||||
cache = true;
|
||||
}
|
||||
pos = inputProperties.indexOf("+query");
|
||||
if (pos > -1) {
|
||||
queryFetchBatch = parseBatchHint(pos, "+query");
|
||||
}
|
||||
pos = inputProperties.indexOf("+lazy");
|
||||
if (pos > -1) {
|
||||
lazyFetchBatch = parseBatchHint(pos, "+lazy");
|
||||
}
|
||||
|
||||
LinkedHashSet<String> included = parseIncluded();
|
||||
String properties = (allProperties) ? "*" : outputProperties;
|
||||
return new Response(readOnly, cache, queryFetchBatch, lazyFetchBatch, properties, included);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the include separating by comma or semicolon.
|
||||
*/
|
||||
private LinkedHashSet<String> parseIncluded() {
|
||||
|
||||
inputProperties = inputProperties.trim();
|
||||
if (inputProperties.isEmpty()) {
|
||||
// default properties
|
||||
return null;
|
||||
}
|
||||
if (inputProperties.equals("*")) {
|
||||
// explicit all properties
|
||||
allProperties = true;
|
||||
return null;
|
||||
return new Response(readOnly, cache, queryFetchBatch, lazyFetchBatch, "*", null);
|
||||
}
|
||||
|
||||
List<String> res = splitRawSelect(inputProperties);
|
||||
|
||||
StringBuilder sb = new StringBuilder(70);
|
||||
LinkedHashSet<String> propertySet = new LinkedHashSet<>(res.size() * 2);
|
||||
|
||||
int count = 0;
|
||||
String temp;
|
||||
for (String re : res) {
|
||||
temp = re.trim();
|
||||
if (!temp.isEmpty()) {
|
||||
if (count > 0) {
|
||||
sb.append(",");
|
||||
}
|
||||
sb.append(temp);
|
||||
propertySet.add(temp);
|
||||
count++;
|
||||
boolean hints = false;
|
||||
Set<String> fields = splitRawSelect(inputProperties);
|
||||
final Iterator<String> iterator = fields.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String val = iterator.next();
|
||||
if (val.startsWith("+")) {
|
||||
hints = true;
|
||||
iterator.remove();
|
||||
parseHint(val);
|
||||
} else if (val.equals("*")) {
|
||||
allProperties = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (propertySet.isEmpty()) {
|
||||
// default properties
|
||||
return null;
|
||||
String properties = allProperties ? "*" : hints ? String.join(",", fields) : inputProperties;
|
||||
if (fields.isEmpty()) {
|
||||
fields = null;
|
||||
}
|
||||
return new Response(readOnly, cache, queryFetchBatch, lazyFetchBatch, properties, fields);
|
||||
}
|
||||
|
||||
if (propertySet.contains("*")) {
|
||||
// explicit all properties
|
||||
allProperties = true;
|
||||
return null;
|
||||
private void parseHint(String val) {
|
||||
if (val.equals("+readonly")) {
|
||||
readOnly = true;
|
||||
} else if (val.equals("+cache")) {
|
||||
cache = true;
|
||||
} else if (val.startsWith("+query")) {
|
||||
queryFetchBatch = parseBatch(val);
|
||||
} else if (val.startsWith("+lazy")) {
|
||||
lazyFetchBatch = parseBatch(val);
|
||||
}
|
||||
}
|
||||
|
||||
// partial properties
|
||||
outputProperties = sb.toString();
|
||||
return propertySet;
|
||||
private int parseBatch(String val) {
|
||||
if (val.endsWith(")")) {
|
||||
int start = val.lastIndexOf('(');
|
||||
if (start > 0) {
|
||||
return Integer.parseInt(val.substring(start + 1, val.length() - 1));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Split allowing 'dynamic function based properties'.
|
||||
*/
|
||||
private List<String> splitRawSelect(String inputProperties) {
|
||||
private Set<String> splitRawSelect(String inputProperties) {
|
||||
return DSelectColumnsParser.parse(inputProperties);
|
||||
}
|
||||
|
||||
private int parseBatchHint(int pos, String option) {
|
||||
|
||||
int startPos = pos + option.length();
|
||||
int endPos = findEndPos(startPos, inputProperties);
|
||||
if (endPos == -1) {
|
||||
inputProperties = inputProperties.replace(option, "");
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
|
||||
String batchParam = inputProperties.substring(startPos + 1, endPos);
|
||||
|
||||
if (endPos + 1 >= inputProperties.length()) {
|
||||
inputProperties = inputProperties.substring(0, pos);
|
||||
} else {
|
||||
inputProperties = inputProperties.substring(0, pos) + inputProperties.substring(endPos + 1);
|
||||
}
|
||||
return Integer.parseInt(batchParam);
|
||||
}
|
||||
}
|
||||
|
||||
private int findEndPos(int pos, String props) {
|
||||
|
||||
if (pos < props.length()) {
|
||||
if (props.charAt(pos) == '(') {
|
||||
int endPara = props.indexOf(')', pos + 1);
|
||||
if (endPara == -1) {
|
||||
throw new RuntimeException("Error could not find ')' in " + props + " after position " + pos);
|
||||
}
|
||||
return endPara;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import io.ebeaninternal.server.util.DSelectColumnsParser;
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
@@ -28,11 +29,8 @@ final class DRawSqlColumnsParser {
|
||||
}
|
||||
|
||||
private ColumnMapping parse() {
|
||||
|
||||
List<String> columnList = DSelectColumnsParser.parse(sqlSelect);
|
||||
|
||||
Set<String> columnList = DSelectColumnsParser.parse(sqlSelect);
|
||||
List<ColumnMapping.Column> columns = new ArrayList<>(columnList.size());
|
||||
|
||||
for (String rawColumn : columnList) {
|
||||
columns.add(parseColumn(rawColumn));
|
||||
}
|
||||
@@ -40,7 +38,6 @@ final class DRawSqlColumnsParser {
|
||||
}
|
||||
|
||||
private ColumnMapping.Column parseColumn(String colInfo) {
|
||||
|
||||
String[] split = COLINFO_SPLIT.split(colInfo);
|
||||
if (split.length > 1) {
|
||||
ArrayList<String> tmp = new ArrayList<>(split.length);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ebeaninternal.server.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Splits a select clause into 'logical columns' taking into account functions and quotes.
|
||||
@@ -14,7 +14,7 @@ public final class DSelectColumnsParser {
|
||||
|
||||
private int pos;
|
||||
|
||||
public static List<String> parse(String sqlSelect) {
|
||||
public static Set<String> parse(String sqlSelect) {
|
||||
return new DSelectColumnsParser(sqlSelect).parse();
|
||||
}
|
||||
|
||||
@@ -23,9 +23,8 @@ public final class DSelectColumnsParser {
|
||||
this.end = selectClause.length();
|
||||
}
|
||||
|
||||
private List<String> parse() {
|
||||
|
||||
ArrayList<String> columns = new ArrayList<>();
|
||||
private Set<String> parse() {
|
||||
LinkedHashSet<String> columns = new LinkedHashSet<>();
|
||||
while (pos <= end) {
|
||||
columns.add(nextColumnInfo());
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package io.ebeaninternal.server.util;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -11,49 +11,49 @@ public class DSelectColumnsParserTest {
|
||||
@Test
|
||||
public void parse() {
|
||||
|
||||
List<String> cols = DSelectColumnsParser.parse("a,MD5(id::text) as b,c");
|
||||
Set<String> cols = DSelectColumnsParser.parse("a,MD5(id::text) as b,c");
|
||||
assertThat(cols).containsExactly("a", "MD5(id::text) as b", "c");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whitespace_is_trimmed() {
|
||||
|
||||
List<String> cols = DSelectColumnsParser.parse("a , MD5(id::text) as b , c ");
|
||||
Set<String> cols = DSelectColumnsParser.parse("a , MD5(id::text) as b , c ");
|
||||
assertThat(cols).containsExactly("a", "MD5(id::text) as b", "c");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nestedFunctions() {
|
||||
|
||||
List<String> cols = DSelectColumnsParser.parse("a , concat(id,'sd',inner(foo)) as b , c ");
|
||||
Set<String> cols = DSelectColumnsParser.parse("a , concat(id,'sd',inner(foo)) as b , c ");
|
||||
assertThat(cols).containsExactly("a", "concat(id,'sd',inner(foo)) as b", "c");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void basic() {
|
||||
|
||||
List<String> cols = DSelectColumnsParser.parse("name , status , billingAddress ");
|
||||
Set<String> cols = DSelectColumnsParser.parse("name , status , billingAddress ");
|
||||
assertThat(cols).containsExactly("name", "status", "billingAddress");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void basic_noWhitespace() {
|
||||
|
||||
List<String> cols = DSelectColumnsParser.parse("a,b,c");
|
||||
Set<String> cols = DSelectColumnsParser.parse("a,b,c");
|
||||
assertThat(cols).containsExactly("a", "b", "c");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void formula_noWhitespace() {
|
||||
|
||||
List<String> cols = DSelectColumnsParser.parse("a,concat(x,y),c");
|
||||
Set<String> cols = DSelectColumnsParser.parse("a,concat(x,y),c");
|
||||
assertThat(cols).containsExactly("a", "concat(x,y)", "c");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void with_logicalCast_andAsAlias() {
|
||||
|
||||
List<String> cols = DSelectColumnsParser.parse("name , concat(status,'-end')::String as fullName , billingAddress ");
|
||||
Set<String> cols = DSelectColumnsParser.parse("name , concat(status,'-end')::String as fullName , billingAddress ");
|
||||
assertThat(cols).containsExactly("name", "concat(status,'-end')::String as fullName", "billingAddress");
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public class TestQueryJoin extends BaseTestCase {
|
||||
|
||||
Query<Order> query = Ebean.find(Order.class).select("status")
|
||||
// .join("details","+query(10)")
|
||||
.fetch("customer", "+lazy(10) name, status").fetch("customer.contacts").order().asc("id");
|
||||
.fetch("customer", "+lazy(10), name, status").fetch("customer.contacts").order().asc("id");
|
||||
// .join("customer.billingAddress");
|
||||
|
||||
List<Order> list = query.findList();
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.tests.model.interfaces;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToMany;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
public class SelfManyMany {
|
||||
|
||||
@Id
|
||||
private long id;
|
||||
|
||||
private final String name;
|
||||
|
||||
@ManyToMany
|
||||
// requires explicit @JoinTable
|
||||
@JoinTable(name = "self_many_bridge",
|
||||
joinColumns = @JoinColumn(name = "self_1_id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "self_2_id"))
|
||||
private List<SelfManyMany> related;
|
||||
|
||||
public SelfManyMany(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public List<SelfManyMany> getRelated() {
|
||||
return related;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.tests.model.interfaces;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TestSelfMany extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void self_manyToMany() {
|
||||
|
||||
SelfManyMany m = new SelfManyMany("1");
|
||||
DB.save(m);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean ddl generation</name>
|
||||
@@ -29,14 +29,14 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean external mapping api</name>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
<!-- <parent>-->
|
||||
<!-- <groupId>org.avaje</groupId>-->
|
||||
@@ -33,7 +33,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -59,14 +59,14 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean postgis</name>
|
||||
@@ -24,7 +24,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
<!-- <parent>-->
|
||||
<!-- <groupId>org.avaje</groupId>-->
|
||||
@@ -27,7 +27,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -67,14 +67,14 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
+6
-6
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-redis</artifactId>
|
||||
@@ -22,35 +22,35 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
<!-- <parent>-->
|
||||
<!-- <groupId>org.avaje</groupId>-->
|
||||
@@ -43,14 +43,14 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
+4
-18
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean composite</name>
|
||||
@@ -22,34 +22,20 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Technically optional but most expected to use query beans -->
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- In future ebean-ddl-generator would only be dependency of ebean-test -->
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- In future this is optional and not included by default -->
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-autotune</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>kotlin querybean generator</name>
|
||||
@@ -29,7 +29,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
+21
@@ -8,6 +8,9 @@ import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -42,6 +45,23 @@ class SimpleQueryBeanWriter {
|
||||
"kotlin.Char"
|
||||
};
|
||||
|
||||
// These are special classes under Kotlin, and are auto-imported, same as
|
||||
// java.lang under Java
|
||||
private static final Set<String> kotlinBlackListedImports = Collections.unmodifiableSet(
|
||||
new HashSet<>(
|
||||
Arrays.asList(
|
||||
"java.util.ArrayList",
|
||||
"java.util.HashMap",
|
||||
"java.util.HashSet",
|
||||
"java.util.LinkedHashMap",
|
||||
"java.util.LinkedHashSet",
|
||||
"java.util.List",
|
||||
"java.util.Map",
|
||||
"java.util.Set"
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
private final Set<String> importTypes = new TreeSet<>();
|
||||
|
||||
private final List<PropertyMeta> properties = new ArrayList<>();
|
||||
@@ -158,6 +178,7 @@ class SimpleQueryBeanWriter {
|
||||
importTypes.add(kotlinTypes[i]);
|
||||
}
|
||||
}
|
||||
importTypes.removeAll(kotlinBlackListedImports);
|
||||
}
|
||||
|
||||
private boolean isEntity() {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>ebean parent</name>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.6.7-SNAPSHOT</version>
|
||||
<version>12.6.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>querybean generator</name>
|
||||
|
||||
Reference in New Issue
Block a user