return beanExists(bean, transactionHandler.getConnection());
}
public boolean beanExists(T bean, Connection connection) throws SQLException {
BooleanQuery query = null;
try {
query = new BooleanQuery(connection, false, this.checkIfExistsSQL);
IntegerCounter integerCounter = new IntegerCounter();
// Keys from SimpleColumns for where statement
this.setQueryValues(bean, query, integerCounter, this.simpleKeys);
// Keys from many to one relations for where statement
this.setQueryValues(bean, query, integerCounter, this.manyToOneRelationKeys.values());
return query.executeQuery();
} finally {
BooleanQuery.autoCloseQuery(query);
}