mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-28 07:26:56 +00:00
#530 - Bad join with raw() expression on a @ManyToMany path.
This commit is contained in:
1 parent
d33afd85de
commit
e7c6223799
2 files changed
+16
-2
No files matched your search
@@ -100,8 +100,9 @@ public class SqlTreeNodeExtraJoin implements SqlTreeNode {
|
||||
|
||||
if (pathContainsMany) {
|
||||
// "promote" to left outer as the path contains a many
|
||||
assocBeanProperty.addJoin(SqlJoinType.OUTER, prefix, ctx);
|
||||
} else if (!manyToMany) {
|
||||
joinType = SqlJoinType.OUTER;
|
||||
}
|
||||
if (!manyToMany) {
|
||||
assocBeanProperty.addJoin(joinType, prefix, ctx);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.avaje.tests.basic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.avaje.ebean.Query;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
@@ -42,4 +43,16 @@ public class TestM2MCascadeOne extends BaseTestCase {
|
||||
Ebean.save(u1);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRawPredicate_with_ManyToManyPath() {
|
||||
|
||||
Query<MUser> query = Ebean.find(MUser.class)
|
||||
.select("userid")
|
||||
.where().raw("roles.roleid in (?)", 24)
|
||||
.query();
|
||||
|
||||
query.findList();
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user