diff --git a/ebean-api/pom.xml b/ebean-api/pom.xml index 1d3c76290..b67a4459f 100644 --- a/ebean-api/pom.xml +++ b/ebean-api/pom.xml @@ -4,7 +4,7 @@ ebean-parent io.ebean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT ebean api diff --git a/ebean-autotune/pom.xml b/ebean-autotune/pom.xml index a9650d5d0..211349a54 100644 --- a/ebean-autotune/pom.xml +++ b/ebean-autotune/pom.xml @@ -4,7 +4,7 @@ ebean-parent io.ebean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT @@ -26,7 +26,7 @@ io.ebean ebean-core - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT provided diff --git a/ebean-bom/pom.xml b/ebean-bom/pom.xml index 9c151ac50..5627cbbf9 100644 --- a/ebean-bom/pom.xml +++ b/ebean-bom/pom.xml @@ -4,7 +4,7 @@ ebean-parent io.ebean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT ebean bom @@ -71,88 +71,88 @@ io.ebean ebean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT io.ebean ebean-api - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT io.ebean ebean-core - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT io.ebean ebean-core-type - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT io.ebean ebean-ddl-generator - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT io.ebean ebean-externalmapping-api - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT io.ebean ebean-externalmapping-xml - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT io.ebean ebean-autotune - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT io.ebean ebean-querybean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT io.ebean querybean-generator - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT provided io.ebean kotlin-querybean-generator - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT provided io.ebean ebean-test - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT test io.ebean ebean-postgis - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT io.ebean ebean-redis - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT diff --git a/ebean-core-type/pom.xml b/ebean-core-type/pom.xml index 322ac4fe3..fe0d4888a 100644 --- a/ebean-core-type/pom.xml +++ b/ebean-core-type/pom.xml @@ -4,7 +4,7 @@ ebean-parent io.ebean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT ebean-core-type @@ -16,7 +16,7 @@ io.ebean ebean-api - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT diff --git a/ebean-core/pom.xml b/ebean-core/pom.xml index a3fd43f5a..f902be3fd 100644 --- a/ebean-core/pom.xml +++ b/ebean-core/pom.xml @@ -3,7 +3,7 @@ ebean-parent io.ebean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT ebean-core @@ -41,19 +41,19 @@ io.ebean ebean-api - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT io.ebean ebean-core-type - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT io.ebean ebean-externalmapping-api - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT diff --git a/ebean-ddl-generator/pom.xml b/ebean-ddl-generator/pom.xml index cb2f0ca56..0679d53bf 100644 --- a/ebean-ddl-generator/pom.xml +++ b/ebean-ddl-generator/pom.xml @@ -4,7 +4,7 @@ ebean-parent io.ebean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT ebean ddl generation @@ -28,14 +28,14 @@ io.ebean ebean-core-type - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT provided io.ebean ebean-core - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT provided diff --git a/ebean-externalmapping-api/pom.xml b/ebean-externalmapping-api/pom.xml index 8fb3b8c2c..72ab57a4b 100644 --- a/ebean-externalmapping-api/pom.xml +++ b/ebean-externalmapping-api/pom.xml @@ -4,7 +4,7 @@ ebean-parent io.ebean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT ebean external mapping api diff --git a/ebean-externalmapping-xml/pom.xml b/ebean-externalmapping-xml/pom.xml index 3033ccebe..753c7dbd5 100644 --- a/ebean-externalmapping-xml/pom.xml +++ b/ebean-externalmapping-xml/pom.xml @@ -4,7 +4,7 @@ ebean-parent io.ebean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT @@ -33,7 +33,7 @@ io.ebean ebean-externalmapping-api - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT @@ -59,14 +59,14 @@ io.ebean ebean-core - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT test io.ebean ebean-ddl-generator - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT test diff --git a/ebean-postgis/pom.xml b/ebean-postgis/pom.xml index 56ee87ebd..046768e1c 100644 --- a/ebean-postgis/pom.xml +++ b/ebean-postgis/pom.xml @@ -4,7 +4,7 @@ ebean-parent io.ebean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT ebean postgis @@ -23,7 +23,7 @@ io.ebean ebean-core - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT provided @@ -74,7 +74,7 @@ io.ebean ebean-test - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT test diff --git a/ebean-querybean/pom.xml b/ebean-querybean/pom.xml index f5e6b67de..ad680e95d 100644 --- a/ebean-querybean/pom.xml +++ b/ebean-querybean/pom.xml @@ -4,7 +4,7 @@ ebean-parent io.ebean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT ebean querybean @@ -17,7 +17,7 @@ io.ebean ebean-core - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT provided @@ -57,21 +57,21 @@ io.ebean ebean-ddl-generator - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT test io.ebean querybean-generator - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT test io.ebean ebean-test - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT test diff --git a/ebean-redis/pom.xml b/ebean-redis/pom.xml index d016ad72f..571988d2b 100644 --- a/ebean-redis/pom.xml +++ b/ebean-redis/pom.xml @@ -4,7 +4,7 @@ ebean-parent io.ebean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT ebean-redis @@ -22,35 +22,35 @@ io.ebean ebean-api - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT provided io.ebean ebean-core - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT provided io.ebean ebean-querybean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT test io.ebean querybean-generator - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT test io.ebean ebean-test - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT test diff --git a/ebean-test/pom.xml b/ebean-test/pom.xml index c45b654c9..9039501e5 100644 --- a/ebean-test/pom.xml +++ b/ebean-test/pom.xml @@ -4,7 +4,7 @@ ebean-parent io.ebean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT ebean test @@ -29,14 +29,14 @@ io.ebean ebean-core - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT provided io.ebean ebean-ddl-generator - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT diff --git a/ebean-test/src/test/java/org/tests/o2m/TestOneToManyEnhancement.java b/ebean-test/src/test/java/org/tests/o2m/TestOneToManyEnhancement.java new file mode 100644 index 000000000..be1936e6a --- /dev/null +++ b/ebean-test/src/test/java/org/tests/o2m/TestOneToManyEnhancement.java @@ -0,0 +1,29 @@ +package org.tests.o2m; + +import io.ebean.BaseTestCase; +import io.ebean.common.BeanList; +import org.junit.jupiter.api.Test; +import org.tests.model.json.EBasicJsonMap; +import org.tests.o2m.lazy.OmlBaz; +import org.tests.o2m.lazy.OmlFoo; + +import static org.assertj.core.api.Assertions.assertThat; + +class TestOneToManyEnhancement extends BaseTestCase { + + @Test + void test_when_constructorAddsEntry() { + OmlFoo foo = new OmlFoo(new OmlBaz()); + + assertThat(foo.getBazList()).isInstanceOf(BeanList.class); + assertThat(foo.getBazList()).isNotEmpty(); + } + + @Test + void test_commonCase() { + EBasicJsonMap bean = new EBasicJsonMap(); + + assertThat(bean.getDetails()).isInstanceOf(BeanList.class); + assertThat(bean.getDetails()).isEmpty(); + } +} diff --git a/ebean-test/src/test/java/org/tests/o2m/lazy/OmlFoo.java b/ebean-test/src/test/java/org/tests/o2m/lazy/OmlFoo.java index 8195d1757..c460d5d50 100644 --- a/ebean-test/src/test/java/org/tests/o2m/lazy/OmlFoo.java +++ b/ebean-test/src/test/java/org/tests/o2m/lazy/OmlFoo.java @@ -15,7 +15,12 @@ public class OmlFoo { private OmlBar bar; @OneToMany(mappedBy = "foo", cascade = CascadeType.ALL) - private List bazList = new ArrayList(); + private List bazList = new ArrayList<>(); + + public OmlFoo(OmlBaz baz) { + bazList.add(baz); + baz.setFoo(this); + } public Long getId() { return id; diff --git a/ebean-test/src/test/java/org/tests/o2m/lazy/TestLazyManyViaPath.java b/ebean-test/src/test/java/org/tests/o2m/lazy/TestLazyManyViaPath.java index f6c41bebe..e94d21fa9 100644 --- a/ebean-test/src/test/java/org/tests/o2m/lazy/TestLazyManyViaPath.java +++ b/ebean-test/src/test/java/org/tests/o2m/lazy/TestLazyManyViaPath.java @@ -13,11 +13,9 @@ public class TestLazyManyViaPath extends BaseTestCase { @Test public void test() { - OmlBar bar = new OmlBar(); List fooList = new ArrayList<>(); fooList.add(createNewFooWithBar(bar)); - bar.setFooList(fooList); DB.save(bar); @@ -30,26 +28,24 @@ public class TestLazyManyViaPath extends BaseTestCase { // This works List foosList = fooFromDb.getBar().getFooList(); - assertThat(fooList.size()).isEqualTo(1); + assertThat(foosList).hasSize(1); + assertThat(fooList).hasSize(1); OmlBaz bazFromDb = DB .find(OmlBaz.class) .where() .eq("id", bar.getFooList().get(0).getBazList().get(0).getId()) .findOne(); + assert bazFromDb != null; // This does not work and gives the exception List foosList1 = bazFromDb.getFoo().getBar().getFooList(); assertThat(foosList1.size()).isEqualTo(1); - } private static OmlFoo createNewFooWithBar(OmlBar bar) { - OmlFoo foo = new OmlFoo(); + OmlFoo foo = new OmlFoo(new OmlBaz()); foo.setBar(bar); - OmlBaz baz = new OmlBaz(); - baz.setFoo(foo); - foo.getBazList().add(baz); return foo; } diff --git a/ebean/pom.xml b/ebean/pom.xml index 7b1aa36d1..ae27a93d2 100644 --- a/ebean/pom.xml +++ b/ebean/pom.xml @@ -4,7 +4,7 @@ ebean-parent io.ebean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT ebean composite @@ -22,20 +22,20 @@ io.ebean ebean-api - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT io.ebean ebean-core - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT io.ebean ebean-querybean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT diff --git a/kotlin-querybean-generator/pom.xml b/kotlin-querybean-generator/pom.xml index 280f0c246..4e3119533 100644 --- a/kotlin-querybean-generator/pom.xml +++ b/kotlin-querybean-generator/pom.xml @@ -4,7 +4,7 @@ ebean-parent io.ebean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT kotlin querybean generator @@ -29,7 +29,7 @@ io.ebean ebean-querybean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT test @@ -43,7 +43,7 @@ io.ebean ebean-core - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT test @@ -64,7 +64,7 @@ io.ebean ebean-ddl-generator - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT test diff --git a/pom.xml b/pom.xml index 68653b957..091b0426b 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ io.ebean ebean-parent - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT pom ebean parent @@ -46,7 +46,7 @@ 4.2 7.3 12.12.0 - 12.12.0 + 12.12.1 diff --git a/querybean-generator/pom.xml b/querybean-generator/pom.xml index eed542e93..5fd7ff9d4 100644 --- a/querybean-generator/pom.xml +++ b/querybean-generator/pom.xml @@ -4,7 +4,7 @@ ebean-parent io.ebean - 12.12.1-SNAPSHOT + 12.12.2-SNAPSHOT querybean generator diff --git a/tests/test-kotlin/pom.xml b/tests/test-kotlin/pom.xml index 4d892af66..ba2034ca3 100644 --- a/tests/test-kotlin/pom.xml +++ b/tests/test-kotlin/pom.xml @@ -18,7 +18,7 @@ 11 11 - 12.12.0 + 12.12.1 1.5.31 2.12.1 @@ -95,7 +95,7 @@ test process-test-classes - debug=1 + debug=5 testEnhance diff --git a/tests/test-kotlin/src/test/kotlin/io/ebean/test/kotlin/OneToManyEnhancementTest.kt b/tests/test-kotlin/src/test/kotlin/io/ebean/test/kotlin/OneToManyEnhancementTest.kt new file mode 100644 index 000000000..e506115e2 --- /dev/null +++ b/tests/test-kotlin/src/test/kotlin/io/ebean/test/kotlin/OneToManyEnhancementTest.kt @@ -0,0 +1,18 @@ +package io.ebean.test.kotlin + +import io.ebean.common.BeanList +import org.assertj.core.api.Assertions.assertThat +import org.example.order.Customer +import org.example.order.Order +import org.junit.jupiter.api.Test + +class OneToManyEnhancementTest { + + @Test + fun `o2m is BeanCollection`() { + val customer = Customer("foo") + val order = Order(customer) + + assertThat(order.items).isInstanceOf(BeanList::class.java) + } +}