File tree Expand file tree Collapse file tree 3 files changed +15
-9
lines changed
Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Original file line number Diff line number Diff line change 309309 <extensions >true</extensions >
310310 <configuration >
311311 <tiles >
312- <tile >io.ebean.tile:enhancement:14.9 .0</tile >
312+ <tile >io.ebean.tile:enhancement:14.10 .0</tile >
313313 </tiles >
314314 </configuration >
315315 </plugin >
Original file line number Diff line number Diff line change 11package org .tests .model .lazywithid ;
22
3- import io .ebean .common .BeanList ;
4-
53import jakarta .persistence .*;
64import java .util .List ;
75
@@ -15,7 +13,7 @@ public class Tune {
1513 String name ;
1614
1715 @ OneToMany (cascade = CascadeType .ALL )
18- private List <Looney > loonies = new BeanList <>() ;
16+ private List <Looney > loonies ;
1917
2018 public String getName () {
2119 return name ;
Original file line number Diff line number Diff line change @@ -92,11 +92,14 @@ public void test_manyNonRoot_RootHasNoMany() {
9292 .where ().gt ("id" , 0 )
9393 .findList ();
9494
95+ List <String > sql1 = LoggedSql .collect ();
96+ assertThat (sql1 ).hasSize (2 );
97+
9598 assertThat (list1 .get (0 ).orderItems ()).hasSize (2 );
9699 assertThat (list1 .get (0 ).orderDetails ()).hasSize (2 );
97100
98- List < String > sql1 = LoggedSql .collect ();
99- assertThat (sql1 ).hasSize ( 2 );
101+ sql1 = LoggedSql .collect ();
102+ assertThat (sql1 ).describedAs ( "no further lazy loading occurs" ). isEmpty ( );
100103
101104 // This query does not eager fetch invoices. We get an NPE on orderInvoices. Only the main query is executed.
102105 LoggedSql .collect ();
@@ -106,10 +109,15 @@ public void test_manyNonRoot_RootHasNoMany() {
106109 .where ().gt ("id" , 0 )
107110 .findList ();
108111
112+ List <String > sql2 = LoggedSql .collect ();
113+ assertThat (sql2 ).hasSize (2 );
114+ assertThat (sql2 .get (0 )).contains ("from join_initfields_order t0 left join join_initfields_order_item t1 on t1.order_id = t0.id where" );
115+ assertThat (sql2 .get (1 )).contains ("from join_initfields_order_invoice t0 where " );
116+
109117 assertThat (list2 .get (0 ).orderItems ()).hasSize (2 );
110- assertThat (list2 .get (0 ).orderInvoices ).hasSize (2 );
118+ assertThat (list2 .get (0 ).orderInvoices () ).hasSize (2 );
111119
112- List < String > sql2 = LoggedSql .stop ();
113- assertThat (sql2 ).hasSize ( 2 );
120+ sql2 = LoggedSql .stop ();
121+ assertThat (sql2 ).describedAs ( "no further lazy loading occurs" ). isEmpty ( );
114122 }
115123}
You can’t perform that action at this time.
0 commit comments