方法 getAllViewsCursor() 没有返回带有测试数据的正确结果。由于 Account 和 Activity 现在具有多对多关系,因此以下带有 null 子句的查询没有给出实际结果
select * FROM Activity as e INNER JOIN e.account as a WHERE e.numTimes < 15 and (e.account = null or a.isActive = false)
act5 的 account 应该有 null 值,而 act7 应该有 acc1。当它被逆转并且测试失败时。您可以尝试在方法末尾的 TestJoins.java 的 testOuterJoinWithNullClause() 方法中添加以下行。
rows.next();
List<TypedRow> joinedRow1 = rows.getCurrent();
TypedRow typedRow1 = joinedRow1.get(0);
TypedRow theJoinedRow1 = joinedRow1.get(1);
log.info("joinedRow1= "+joinedRow1);
Assert.assertEquals("e", typedRow1.getView().getAlias());
Assert.assertEquals("act5", typedRow1.getRowKeyString());
Assert.assertEquals(null, theJoinedRow1.getRowKey());
rows.next();
List<TypedRow> joinedRow2 = rows.getCurrent();
TypedRow typedRow2 = joinedRow2.get(0);
TypedRow theJoinedRow2 = joinedRow2.get(1);
log.info("joinedRow1= "+joinedRow2);
Assert.assertEquals("e", typedRow2.getView().getAlias());
Assert.assertEquals("act7", typedRow2.getRowKeyString());
Assert.assertEquals("acc1", theJoinedRow2.getRowKey());