@SuppressWarnings("unchecked") static <T> Query<T> from(Db db, T alias) { Query<T> query = new Query<T>(db); TableDefinition<T> def = (TableDefinition<T>) db.define(alias.getClass()); query.from = new SelectTable<T>(db, query, alias, false); def.initSelectObject(query.from, alias, query.aliasMap); return query; }
/** * Join another table. * * @param alias an alias for the table to join * @return the joined query */ @SuppressWarnings("unchecked") public <U> QueryJoin innerJoin(U alias) { TableDefinition<T> def = (TableDefinition<T>) db.define(alias.getClass()); SelectTable<T> join = new SelectTable(db, this, alias, false); def.initSelectObject(join, alias, aliasMap); joins.add(join); return new QueryJoin(this, join); }