mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#2184 - Fix for findNative() with fetch() - convert fetch to fetchQuery with nativeSql
When using nativeSql (think of it as the "root query") we can't use "fetch joins" (FetchConfig.ofDefault()) as that means to prefer to use a SQL JOIN. In this nativeSql case we need to effectively automatically convert fetch() to fetchQuery()
This commit is contained in:
@@ -1441,6 +1441,10 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
|
||||
@Override
|
||||
public Query<T> fetch(String path, String properties, FetchConfig config) {
|
||||
if (nativeSql != null && (config == null || config.isJoin())) {
|
||||
// can't use fetch join with nativeSql (as the root query)
|
||||
config = FETCH_QUERY;
|
||||
}
|
||||
return fetchInternal(path, properties, config);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user