mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#2195 - @Aggregation on OneToMany property not mapping to column properly
This commit is contained in:
@@ -324,9 +324,9 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
this.generatedProperty = deploy.getGeneratedProperty();
|
||||
this.getter = deploy.getGetter();
|
||||
this.setter = deploy.getSetter();
|
||||
this.aggregation = deploy.parseAggregation();
|
||||
this.dbColumn = tableAliasIntern(descriptor, deploy.getDbColumn(), false, null);
|
||||
this.dbComment = deploy.getDbComment();
|
||||
this.aggregation = deploy.parseAggregation();
|
||||
this.sqlFormulaJoin = InternString.intern(deploy.getSqlFormulaJoin());
|
||||
this.sqlFormulaSelect = InternString.intern(deploy.getSqlFormulaSelect());
|
||||
this.formula = sqlFormulaSelect != null;
|
||||
|
||||
+16
-2
@@ -16,6 +16,7 @@ import io.ebean.event.BeanPostLoad;
|
||||
import io.ebean.event.BeanQueryAdapter;
|
||||
import io.ebean.event.changelog.ChangeLogFilter;
|
||||
import io.ebean.text.PathProperties;
|
||||
import io.ebean.util.SplitName;
|
||||
import io.ebeaninternal.api.ConcurrencyMode;
|
||||
import io.ebeaninternal.server.core.CacheOptions;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor.EntityType;
|
||||
@@ -1149,8 +1150,21 @@ public class DeployBeanDescriptor<T> {
|
||||
return null;
|
||||
}
|
||||
// use 'current' table alias - refer BeanProperty appendSelect() for aggregation
|
||||
DeployBeanProperty property = propMap.get(expression);
|
||||
return (property == null) ? null : "${ta}." + property.getDbColumn();
|
||||
String[] split = SplitName.split(expression);
|
||||
if (split[0] == null) {
|
||||
DeployBeanProperty property = propMap.get(expression);
|
||||
return (property == null) ? null : "${ta}." + property.getDbColumn();
|
||||
} else {
|
||||
DeployBeanProperty property = propMap.get(split[0]);
|
||||
if (property instanceof DeployBeanPropertyAssoc) {
|
||||
DeployBeanPropertyAssoc<?> prop = (DeployBeanPropertyAssoc<?>) property;
|
||||
DeployBeanProperty beanProperty = prop.getTargetDeploy().getBeanProperty(split[1]);
|
||||
if (beanProperty != null) {
|
||||
return "u1." + beanProperty.getDbColumn();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-2
@@ -682,7 +682,6 @@ public class DeployBeanProperty {
|
||||
*/
|
||||
public void setAggregationPrefix(String prefix) {
|
||||
this.aggregationPrefix = prefix;
|
||||
this.aggregation = (prefix == null) ? aggregation : aggregation.replace(aggregationPrefix, "u1");
|
||||
}
|
||||
|
||||
public String getElPrefix() {
|
||||
@@ -715,7 +714,7 @@ public class DeployBeanProperty {
|
||||
return sqlFormulaSelect;
|
||||
}
|
||||
if (aggregation != null) {
|
||||
return aggregation;
|
||||
return aggregationParsed == null ? dbColumn : aggregationParsed;
|
||||
}
|
||||
return dbColumn;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user