@Override protected SubqueryTable asNewAliasWithPropertiesArray(String newAlias, Property<?>[] newProperties) { return new SubqueryTable(modelClass, newProperties, newAlias, query); }
/** * Alias this query, for use when creating a subquery to select from * * @param alias the name for the table when this query is used as a subquery * @param modelClass the model class representing the subquery * @return a {@link SubqueryTable} from this Query */ public SubqueryTable as(String alias, Class<? extends ViewModel> modelClass, Property<?>[] properties) { return SubqueryTable.fromQuery(this, alias, modelClass, properties); }
@Override void appendToSqlBuilder(SqlBuilder builder, boolean forSqlValidation) { builder.sql.append("("); query.appendToSqlBuilder(builder, forSqlValidation); builder.sql.append(") AS ").append(getName()); } }
/** * Construct a new Select statement that queries all the {@link Field}s of the given subquery * * @param subquery the inner Query object * @param subqueryAlias the name to alias the subquery * @return a new Query object */ public static Query fromSubquery(Query subquery, String subqueryAlias) { SubqueryTable table = subquery.as(subqueryAlias); return Query.select(table.qualifiedFields()).from(table); }
/** * Construct a new Select statement that queries all the {@link Field}s of the given subquery * * @param subquery the inner Query object * @param subqueryAlias the name to alias the subquery * @return a new Query object */ public static Query fromSubquery(Query subquery, String subqueryAlias) { SubqueryTable table = subquery.as(subqueryAlias); return Query.select(table.qualifiedFields()).from(table); }
/** * Construct a new SubqueryTable backed by the given Query and aliased to the given name * * @param query the backing Query * @param name the name for the table * @return a new SubqueryTable */ public static SubqueryTable fromQuery(Query query, String name) { return new SubqueryTable(null, null, name, query); }
/** * Alias this query, for use when creating a subquery to select from * * @param alias the name for the table when this query is used as a subquery * @return a {@link SubqueryTable} from this Query */ public SubqueryTable as(String alias) { return SubqueryTable.fromQuery(this, alias); }
@Override void appendToSqlBuilder(SqlBuilder builder, boolean forSqlValidation) { builder.sql.append("("); query.appendToSqlBuilder(builder, forSqlValidation); builder.sql.append(") AS ").append(getName()); } }
/** * Construct a new SubqueryTable backed by the given Query and aliased to the given name and associate it with the * given ViewModel * * @param query the backing Query * @param name the name for the table * @param modelClass the ViewModel to associate * @return a new SubqueryTable */ public static SubqueryTable fromQuery(Query query, String name, Class<? extends ViewModel> modelClass, Property<?>[] properties) { return new SubqueryTable(modelClass, properties, name, query); }
/** * Alias this query, for use when creating a subquery to select from * * @param alias the name for the table when this query is used as a subquery * @return a {@link SubqueryTable} from this Query */ public SubqueryTable as(String alias) { return SubqueryTable.fromQuery(this, alias); }
@Override protected SubqueryTable asNewAliasWithPropertiesArray(String newAlias, Property<?>[] newProperties) { return new SubqueryTable(modelClass, newProperties, newAlias, query); }
/** * Alias this query, for use when creating a subquery to select from * * @param alias the name for the table when this query is used as a subquery * @param modelClass the model class representing the subquery * @return a {@link SubqueryTable} from this Query */ public SubqueryTable as(String alias, Class<? extends ViewModel> modelClass, Property<?>[] properties) { return SubqueryTable.fromQuery(this, alias, modelClass, properties); }
/** * Construct a new SubqueryTable backed by the given Query and aliased to the given name and associate it with the * given ViewModel * * @param query the backing Query * @param name the name for the table * @param modelClass the ViewModel to associate * @return a new SubqueryTable */ public static SubqueryTable fromQuery(Query query, String name, Class<? extends ViewModel> modelClass, Property<?>[] properties) { return new SubqueryTable(modelClass, properties, name, query); }
/** * Construct a new SubqueryTable backed by the given Query and aliased to the given name * * @param query the backing Query * @param name the name for the table * @return a new SubqueryTable */ public static SubqueryTable fromQuery(Query query, String name) { return new SubqueryTable(null, null, name, query); }