mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-18 14:58:47 +00:00
#222 - SQL Server - OnetoMany with compound key using IN is not legal in mssql
This commit is contained in:
1 parent
965de6e84d
commit
d54cffacea
6 files changed
+41
-38
No files matched your search
@@ -25,6 +25,11 @@ public interface IdBinder {
|
||||
*/
|
||||
public void initialise();
|
||||
|
||||
/**
|
||||
* Return true if this is a compound key and must use expanded and or form.
|
||||
*/
|
||||
public boolean isIdInExpandedForm();
|
||||
|
||||
/**
|
||||
* Write the Id value to binary DataOuput.
|
||||
*/
|
||||
|
||||
@@ -43,17 +43,21 @@ public final class IdBinderEmbedded implements IdBinder {
|
||||
this.idInValueSql = idInExpandedForm ? idInExpanded() : idInCompressed();
|
||||
}
|
||||
|
||||
public boolean isIdInExpandedForm() {
|
||||
return idInExpandedForm;
|
||||
}
|
||||
|
||||
private String idInExpanded() {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder(30);
|
||||
sb.append("(");
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
if (i > 0) {
|
||||
sb.append(" and ");
|
||||
}
|
||||
sb.append(embIdProperty.getName());
|
||||
sb.append(idDesc.getBaseTableAlias());
|
||||
sb.append(".");
|
||||
sb.append(props[i].getName());
|
||||
sb.append(props[i].getDbColumn());
|
||||
sb.append("=?");
|
||||
}
|
||||
sb.append(")");
|
||||
|
||||
@@ -30,6 +30,10 @@ public final class IdBinderEmpty implements IdBinder {
|
||||
|
||||
}
|
||||
|
||||
public boolean isIdInExpandedForm() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getOrderBy(String pathPrefix, boolean ascending) {
|
||||
return pathPrefix;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,11 @@ public final class IdBinderSimple implements IdBinder {
|
||||
public void initialise(){
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
public boolean isIdInExpandedForm() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getOrderBy(String pathPrefix, boolean ascending) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
Reference in new issue
Block a user