mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-23 10:03:59 +00:00
#2753 - Fix for, Bug findSingleAttributeList o2m distinct
This commit is contained in:
@@ -458,8 +458,8 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
/**
|
||||
* Return the many property that is fetched in the query or null if there is not one.
|
||||
*/
|
||||
public BeanPropertyAssocMany<?> manyProperty() {
|
||||
return manyProperty;
|
||||
public BeanPropertyAssocMany<?> manyPropertyForOrderBy() {
|
||||
return query.isSingleAttribute() ? null : manyProperty;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -225,7 +225,7 @@ public final class CQueryPredicates {
|
||||
*/
|
||||
private void parsePropertiesToDbColumns(DeployParser deployParser) {
|
||||
// order by is dependent on the manyProperty (if there is one)
|
||||
String logicalOrderBy = deriveOrderByWithMany(request.manyProperty());
|
||||
String logicalOrderBy = deriveOrderByWithMany(request.manyPropertyForOrderBy());
|
||||
if (logicalOrderBy != null) {
|
||||
dbOrderBy = deployParser.parse(logicalOrderBy);
|
||||
}
|
||||
@@ -234,7 +234,7 @@ public final class CQueryPredicates {
|
||||
dbWhere = deriveWhere(deployParser);
|
||||
dbFilterMany = deriveFilterMany(deployParser);
|
||||
dbHaving = deriveHaving(deployParser);
|
||||
// all includes including ones for manyWhere clause
|
||||
// all includes, including ones for manyWhere clause
|
||||
predicateIncludes = deployParser.getIncludes();
|
||||
}
|
||||
|
||||
@@ -293,8 +293,7 @@ public final class CQueryPredicates {
|
||||
}
|
||||
|
||||
/**
|
||||
* There is a many property so we need to make sure the ordering is
|
||||
* appropriate.
|
||||
* There is a many property we need to make sure the ordering is appropriate.
|
||||
*/
|
||||
private String deriveOrderByWithMany(BeanPropertyAssocMany<?> manyProp) {
|
||||
if (manyProp == null) {
|
||||
|
||||
@@ -757,8 +757,7 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void oneToMany_distinct() {
|
||||
|
||||
void oneToMany_distinct() {
|
||||
ResetBasicData.reset();
|
||||
|
||||
Query<Customer> query = DB.find(Customer.class)
|
||||
|
||||
Reference in New Issue
Block a user