mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1167 - BUG: query.setId(...).delete() does not work
This commit is contained in:
@@ -1666,8 +1666,12 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
* Return the sql for binding an id. This is the columns with table alias that
|
||||
* make up the id.
|
||||
*/
|
||||
public String getIdBinderIdSql() {
|
||||
return idBinderIdSql;
|
||||
public String getIdBinderIdSql(String alias) {
|
||||
if (alias == null) {
|
||||
return idBinderIdSql;
|
||||
} else {
|
||||
return idBinder.getBindIdSql(alias);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -58,7 +58,7 @@ class IdExpression extends NonPrepareExpression implements SpiExpression {
|
||||
public void addSql(SpiExpressionRequest request) {
|
||||
|
||||
DefaultExpressionRequest r = (DefaultExpressionRequest) request;
|
||||
String idSql = r.getBeanDescriptor().getIdBinderIdSql();
|
||||
String idSql = r.getBeanDescriptor().getIdBinderIdSql(null);
|
||||
|
||||
request.append(idSql).append(" ");
|
||||
}
|
||||
|
||||
@@ -564,7 +564,7 @@ class CQueryBuilder {
|
||||
appendWhere(hasWhere, sb);
|
||||
|
||||
BeanDescriptor<?> desc = request.getBeanDescriptor();
|
||||
String idSql = desc.getIdBinderIdSql();
|
||||
String idSql = desc.getIdBinderIdSql(query.getAlias());
|
||||
if (idSql.isEmpty()) {
|
||||
throw new IllegalStateException("Executing FindById query on entity bean " + desc.getName()
|
||||
+ " that doesn't have an @Id property??");
|
||||
|
||||
@@ -86,7 +86,7 @@ class CQueryBuilderRawSql {
|
||||
BeanDescriptor<?> descriptor = request.getBeanDescriptor();
|
||||
//FIXME: I think this is broken... needs to be logical
|
||||
// and then parsed for RawSqlSelect...
|
||||
dynamicWhere = descriptor.getIdBinderIdSql();
|
||||
dynamicWhere = descriptor.getIdBinderIdSql(null);
|
||||
}
|
||||
|
||||
String dbWhere = predicates.getDbWhere();
|
||||
|
||||
Reference in New Issue
Block a user