@Override protected Integer mapForeignKey(ResultSet rs) throws SQLException { String fkPath = columnLabel(qAddress.addressCustomerRef.getLocalColumns().get(0)); if (rs.getObject(fkPath) != null) { return rs.getInt(fkPath); } else { return null; } }
@Override @Transactional(readOnly = true) public List<Customer> findAll() { SQLQuery allCustomersQuery = qdslTemplate.newSqlQuery().from(qCustomer) .leftJoin(qCustomer._addressCustomerRef, qAddress); return qdslTemplate.query(allCustomersQuery, new CustomerListExtractor(), customerAddressProjection); }
public SQLTemplates build() { SQLTemplates templates = build(escape, quote); if (newLineToSingleSpace) { templates.newLineToSingleSpace(); } templates.setPrintSchema(printSchema); return templates; }
/** * Register a schema specific table override * * @param schema * @param oldTable * @param newSchema * @param newTable * @return */ public SchemaAndTable registerTableOverride(String schema, String oldTable, String newSchema, String newTable) { return registerTableOverride(new SchemaAndTable(schema, oldTable), new SchemaAndTable(newSchema, newTable)); }
/** * Called to make the call back to listeners when an exception happens * * @param context the current context in play * @param e the exception */ protected void onException(SQLListenerContextImpl context, Exception e) { context.setException(e); listeners.exception(context); }
/** * Called to create and start a new SQL Listener context * * @param connection the database connection * @param metadata the meta data for that context * @return the newly started context */ protected SQLListenerContextImpl startContext(Connection connection, QueryMetadata metadata) { SQLListenerContextImpl context = new SQLListenerContextImpl(metadata, connection); listeners.start(context); return context; }
@Override public void notifyMerge(RelationalPath<?> entity, QueryMetadata md, List<Path<?>> keys, List<Path<?>> columns, List<Expression<?>> values, SubQueryExpression<?> subQuery) { if (parent != null) { parent.notifyMerge(entity, md, keys, columns, values, subQuery); } for (SQLListener listener : listeners) { listener.notifyMerge(entity, md, keys, columns, values, subQuery); } }
@Override public void notifyUpdate(RelationalPath<?> entity, QueryMetadata md, List<Pair<Path<?>, Expression<?>>> updates) { if (parent != null) { parent.notifyUpdate(entity, md, updates); } for (SQLListener listener : listeners) { listener.notifyUpdate(entity, md, updates); } }
/** * Register a schema specific table override * * @param schema * @param oldTable * @param newTable * @return */ public String registerTableOverride(String schema, String oldTable, String newTable) { SchemaAndTable st = registerTableOverride(schema, oldTable, schema, newTable); return st != null ? st.getTable() : null; }
@Override protected void clone(Q query) { super.clone(query); this.useLiterals = query.useLiterals; this.listeners = new SQLListeners(query.listeners); }
@Override public void notifyDeletes(RelationalPath<?> entity, List<QueryMetadata> batches) { if (parent != null) { parent.notifyDeletes(entity, batches); } for (SQLListener listener : listeners) { listener.notifyDeletes(entity, batches); } }
@Override public void notifyUpdates(RelationalPath<?> entity, List<SQLUpdateBatch> batches) { if (parent != null) { parent.notifyUpdates(entity, batches); } for (SQLListener listener : listeners) { listener.notifyUpdates(entity, batches); } }
@Override public void notifyDelete(RelationalPath<?> entity, QueryMetadata md) { if (parent != null) { parent.notifyDelete(entity, md); } for (SQLListener listener : listeners) { listener.notifyDelete(entity, md); } }
@Override public void notifyMerges(RelationalPath<?> entity, QueryMetadata md, List<SQLMergeBatch> batches) { if (parent != null) { parent.notifyMerges(entity, md, batches); } for (SQLListener listener : listeners) { listener.notifyMerges(entity, md, batches); } }
@Override public void notifyInserts(RelationalPath<?> entity, QueryMetadata md, List<SQLInsertBatch> batches) { if (parent != null) { parent.notifyInserts(entity, md, batches); } for (SQLListener listener : listeners) { listener.notifyInserts(entity, md, batches); } }
/** * Called to make the call back to listeners when an exception happens * * @param context the current context in play * @param e the exception */ protected void onException(SQLListenerContextImpl context, Exception e) { context.setException(e); listeners.exception(context); }
/** * Called to create and start a new SQL Listener context * * @param connection the database connection * @param metadata the meta data for that context * @param entity the entity for that context * @return the newly started context */ protected SQLListenerContextImpl startContext(Connection connection, QueryMetadata metadata, RelationalPath<?> entity) { SQLListenerContextImpl context = new SQLListenerContextImpl(metadata, connection, entity); listeners.start(context); return context; }