mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-19 23:02:24 +00:00
#709 - Refactor: BeanCollection internals, rename method isEmptyAndUntouched() to isSkipSave(), remove 'touched' flag
This commit is contained in:
1 parent
1c9b974427
commit
362ceea79b
8 files changed
+32
-65
No files matched your search
@@ -238,13 +238,13 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> {
|
||||
/**
|
||||
* Return true if this is considered 'empty' from a save perspective.
|
||||
*/
|
||||
public boolean isEmptyBeanCollection(EntityBean bean, boolean insertedParent) {
|
||||
public boolean isSkipSaveBeanCollection(EntityBean bean, boolean insertedParent) {
|
||||
Object val = getValue(bean);
|
||||
if (val == null) {
|
||||
return true;
|
||||
}
|
||||
if ((val instanceof BeanCollection<?>)) {
|
||||
return ((BeanCollection<?>) val).isEmptyAndUntouched();
|
||||
return ((BeanCollection<?>) val).isSkipSave();
|
||||
}
|
||||
if (insertedParent) {
|
||||
// check 'vanilla' collection types
|
||||
|
||||
@@ -806,8 +806,8 @@ public final class DefaultPersister implements Persister {
|
||||
// many's with cascade save
|
||||
BeanPropertyAssocMany<?>[] manys = desc.propertiesManySave();
|
||||
for (int i = 0; i < manys.length; i++) {
|
||||
// check that property is loaded and not empty uninitialised collection
|
||||
if (request.isLoadedProperty(manys[i]) && !manys[i].isEmptyBeanCollection(parentBean, insertedParent)) {
|
||||
// check that property is loaded and collection should be cascaded to
|
||||
if (request.isLoadedProperty(manys[i]) && !manys[i].isSkipSaveBeanCollection(parentBean, insertedParent)) {
|
||||
saveMany(new SaveManyPropRequest(insertedParent, manys[i], parentBean, request), insertMode);
|
||||
if (!insertedParent) {
|
||||
request.addUpdatedManyProperty(manys[i]);
|
||||
|
||||
Reference in new issue
Block a user