Search in sources :

Example 1 with InsertBuilder

use of org.apache.cayenne.access.sqlbuilder.InsertBuilder in project cayenne by apache.

the class InsertBatchTranslator method getSql.

@Override
public String getSql() {
    InsertBatchQuery query = context.getQuery();
    InsertBuilder insertBuilder = SQLBuilder.insert(context.getRootDbEntity());
    for (DbAttribute attribute : query.getDbAttributes()) {
        // skip generated attributes, if needed
        if (excludeInBatch(attribute)) {
            continue;
        }
        insertBuilder.column(SQLBuilder.column(attribute.getName()).attribute(attribute)).value(SQLBuilder.value(1).attribute(attribute));
    }
    return doTranslate(insertBuilder);
}
Also used : InsertBuilder(org.apache.cayenne.access.sqlbuilder.InsertBuilder) InsertBatchQuery(org.apache.cayenne.query.InsertBatchQuery) DbAttribute(org.apache.cayenne.map.DbAttribute)

Aggregations

InsertBuilder (org.apache.cayenne.access.sqlbuilder.InsertBuilder)1 DbAttribute (org.apache.cayenne.map.DbAttribute)1 InsertBatchQuery (org.apache.cayenne.query.InsertBatchQuery)1