mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-19 23:02:24 +00:00
Refactor BeanPropertyAssocOne findByParentIds use of raw expression
This commit is contained in:
1 parent
d8dfd66af3
commit
6b54b6ef46
3 files changed
+34
-45
No files matched your search
@@ -21,6 +21,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Abstract base for properties mapped to an associated bean, list, set or map.
|
||||
@@ -41,6 +42,11 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty {
|
||||
|
||||
String targetIdProperty;
|
||||
|
||||
/**
|
||||
* Derived list of exported property and matching foreignKey
|
||||
*/
|
||||
protected ExportedProperty[] exportedProperties;
|
||||
|
||||
/**
|
||||
* Persist settings.
|
||||
*/
|
||||
@@ -385,4 +391,18 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty {
|
||||
+ " Perhaps an error in a @JoinColumn";
|
||||
throw new PersistenceException(msg);
|
||||
}
|
||||
|
||||
protected void bindWhereParentId(List<Object> bindValues, Object parentId) {
|
||||
|
||||
if (exportedProperties.length == 1) {
|
||||
bindValues.add(parentId);
|
||||
|
||||
} else {
|
||||
EntityBean parent = (EntityBean) parentId;
|
||||
for (int i = 0; i < exportedProperties.length; i++) {
|
||||
Object embVal = exportedProperties[i].getValue(parent);
|
||||
bindValues.add(embVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user