
org.bridje.orm.impl.QueryImpl Maven / Gradle / Ivy
/*
* Copyright 2016 Bridje Framework.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.bridje.orm.impl;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.bridje.orm.Column;
import org.bridje.orm.Condition;
import org.bridje.orm.OrderBy;
import org.bridje.orm.Query;
import org.bridje.orm.TableColumn;
import org.bridje.orm.impl.sql.DeleteBuilder;
import org.bridje.orm.impl.sql.InsertBuilder;
import org.bridje.orm.impl.sql.SelectBuilder;
import org.bridje.orm.impl.sql.UpdateBuilder;
class QueryImpl extends AbstractQuery implements Query
{
private final TableImpl table;
private final EntityContextImpl ctx;
private Condition condition;
private OrderBy[] orderBy;
private int page;
private int pageSize;
private Map, Object> sets;
public QueryImpl(EntityContextImpl ctx, TableImpl table)
{
this.table = table;
this.ctx = ctx;
}
@Override
public Query paging(int page, int size)
{
this.page = page;
this.pageSize = size;
return this;
}
@Override
public Query where(Condition condition)
{
this.condition = condition;
return this;
}
@Override
public Query orderBy(OrderBy... statements)
{
orderBy = statements;
return this;
}
@Override
protected SelectBuilder createQuery(String fields, List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy