Skip to content

Commit

Permalink
Merge pull request #3205 from ebean-orm/feature/3173-beanSet-clear
Browse files Browse the repository at this point in the history
Follow up #3173 - Change BeanSet clear() to lazy load ALL properties
  • Loading branch information
rbygrave authored Aug 29, 2023
2 parents dbbf6dd + 5377454 commit 180b4d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ebean-api/src/main/java/io/ebean/common/BeanSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private void initClear() {
try {
if (set == null) {
if (!disableLazyLoad && modifyListening) {
lazyLoadCollection(true);
lazyLoadCollection(false);
} else {
set = new LinkedHashSet<>();
}
Expand Down
6 changes: 2 additions & 4 deletions ebean-test/src/test/java/org/tests/sets/TestO2MSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ void beanSet_when_clear_thenAddSave() {
employees.clear();

sql = LoggedSql.collect();
assertThat(sql).hasSize(3);
assertThat(sql.get(0)).contains("select t0.department_id, t0.id from o2_memp t0 where (t0.department_id)");
assertThat(sql.get(1)).contains("select t0.id, t0.code, t0.name, t0.department_id from o2_memp t0 where t0.id = ?");
assertThat(sql.get(2)).contains("select t0.id, t0.code, t0.name, t0.department_id from o2_memp t0 where t0.id = ?");
assertThat(sql).hasSize(1);
assertThat(sql.get(0)).contains("select t0.department_id, t0.id, t0.code, t0.name, t0.department_id from o2_memp t0 where (t0.department_id)");

final O2MEmp employee2 = new O2MEmp("After1", "Code3");
employees.add(employee2);
Expand Down

0 comments on commit 180b4d6

Please sign in to comment.