Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow up #3173 - Change BeanSet clear() with orphanRemoval to lazy load ALL properties (avoid 1+N) #3205

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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