@Test public void testLeftJoin() throws Exception { Dao<Bar, Integer> barDao = createDao(Bar.class, true); Dao<Baz, Integer> bazDao = createDao(Baz.class, true); Bar bar1 = new Bar(); bar1.val = 2234; assertEquals(1, barDao.create(bar1)); Bar bar2 = new Bar(); bar2.val = 324322234; assertEquals(1, barDao.create(bar2)); Baz baz1 = new Baz(); baz1.bar = bar1; assertEquals(1, bazDao.create(baz1)); Baz baz2 = new Baz(); baz2.bar = bar2; assertEquals(1, bazDao.create(baz2)); Baz baz3 = new Baz(); assertEquals(1, bazDao.create(baz3)); QueryBuilder<Bar, Integer> barQb = barDao.queryBuilder(); List<Baz> results = bazDao.queryBuilder().query(); assertEquals(3, results.size()); results = bazDao.queryBuilder().join(barQb).query(); assertEquals(2, results.size()); results = bazDao.queryBuilder().leftJoin(barQb).query(); assertEquals(3, results.size()); results = bazDao.queryBuilder().join(barQb, JoinType.LEFT, JoinWhereOperation.AND).query(); assertEquals(3, results.size()); }
public QueryBuilder<T, ID> leftJoin(QueryBuilder<?, ?> joinedQueryBuilder) throws SQLException { addJoinInfo(JoinType.LEFT, null, null, joinedQueryBuilder, JoinWhereOperation.AND); return this; }
QueryBuilder extends StatementBuilder<T, ID> { public QueryBuilder<T, ID> leftJoin(QueryBuilder<?, ?> joinedQueryBuilder) throws SQLException { addJoinInfo(JoinType.LEFT, null, null, joinedQueryBuilder, JoinWhereOperation.AND); return this; } }
QueryBuilder extends StatementBuilder<T, ID> { public QueryBuilder<T, ID> leftJoin(QueryBuilder<?, ?> joinedQueryBuilder) throws SQLException { addJoinInfo(JoinType.LEFT, null, null, joinedQueryBuilder, JoinWhereOperation.AND); return this; } QueryBuilder(DatabaseType databaseType, TableInfo<T, ID> tableInfo, Dao<T, ID> dao); }
QueryBuilder extends StatementBuilder<T, ID> { public QueryBuilder<T, ID> leftJoin(QueryBuilder<?, ?> joinedQueryBuilder) throws SQLException { addJoinInfo(JoinType.LEFT, null, null, joinedQueryBuilder, JoinWhereOperation.AND); return this; } QueryBuilder(DatabaseType databaseType, TableInfo<T, ID> tableInfo, Dao<T, ID> dao); PreparedQuery<T> prepare(); QueryBuilder<T, ID> selectColumns(String... columns); QueryBuilder<T, ID> selectColumns(Iterable<String> columns); QueryBuilder<T, ID> selectRaw(String... columns); QueryBuilder<T, ID> groupBy(String columnName); QueryBuilder<T, ID> groupByRaw(String rawSql); QueryBuilder<T, ID> orderBy(String columnName, boolean ascending); QueryBuilder<T, ID> orderByRaw(String rawSql); QueryBuilder<T, ID> orderByRaw(String rawSql, ArgumentHolder... args); QueryBuilder<T, ID> distinct(); QueryBuilder<T, ID> limit(Long maxRows); QueryBuilder<T, ID> offset(Long startRow); QueryBuilder<T, ID> setCountOf(boolean countOf); QueryBuilder<T, ID> setCountOf(String countOfQuery); QueryBuilder<T, ID> having(String having); QueryBuilder<T, ID> join(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> join(QueryBuilder<?, ?> joinedQueryBuilder, JoinType type, JoinWhereOperation operation); QueryBuilder<T, ID> joinOr(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> leftJoin(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> leftJoinOr(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> join(String localColumnName, String joinedColumnName,
			QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> join(String localColumnName, String joinedColumnName,
			QueryBuilder<?, ?> joinedQueryBuilder, JoinType type, JoinWhereOperation operation); List<T> query(); GenericRawResults<String[]> queryRaw(); T queryForFirst(); String[] queryRawFirst(); CloseableIterator<T> iterator(); long countOf(); long countOf(String countOfQuery); QueryBuilder<T, ID> setAlias(String alias); @Override void reset(); }
QueryBuilder extends StatementBuilder<T, ID> { public QueryBuilder<T, ID> leftJoin(QueryBuilder<?, ?> joinedQueryBuilder) throws SQLException { addJoinInfo(JoinType.LEFT, null, null, joinedQueryBuilder, JoinWhereOperation.AND); return this; } QueryBuilder(DatabaseType databaseType, TableInfo<T, ID> tableInfo, Dao<T, ID> dao); PreparedQuery<T> prepare(); QueryBuilder<T, ID> selectColumns(String... columns); QueryBuilder<T, ID> selectColumns(Iterable<String> columns); QueryBuilder<T, ID> selectRaw(String... columns); QueryBuilder<T, ID> groupBy(String columnName); QueryBuilder<T, ID> groupByRaw(String rawSql); QueryBuilder<T, ID> orderBy(String columnName, boolean ascending); QueryBuilder<T, ID> orderByRaw(String rawSql); QueryBuilder<T, ID> orderByRaw(String rawSql, ArgumentHolder... args); QueryBuilder<T, ID> distinct(); QueryBuilder<T, ID> limit(Long maxRows); QueryBuilder<T, ID> offset(Long startRow); QueryBuilder<T, ID> setCountOf(boolean countOf); QueryBuilder<T, ID> setCountOf(String countOfQuery); QueryBuilder<T, ID> having(String having); QueryBuilder<T, ID> join(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> join(QueryBuilder<?, ?> joinedQueryBuilder, JoinType type, JoinWhereOperation operation); QueryBuilder<T, ID> joinOr(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> leftJoin(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> leftJoinOr(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> join(String localColumnName, String joinedColumnName,
			QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> join(String localColumnName, String joinedColumnName,
			QueryBuilder<?, ?> joinedQueryBuilder, JoinType type, JoinWhereOperation operation); List<T> query(); GenericRawResults<String[]> queryRaw(); T queryForFirst(); String[] queryRawFirst(); CloseableIterator<T> iterator(); long countOf(); long countOf(String countOfQuery); QueryBuilder<T, ID> setAlias(String alias); @Override void reset();  }