mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-26 23:22:57 +00:00
Add SAP HANA support (#1511)
This commit is contained in:
1 parent
b1410cc660
commit
158ee9a081
79 files changed
+2596
-215
No files matched your search
@@ -29,9 +29,17 @@ public class TestElementCollectionBasic extends BaseTestCase {
|
||||
assertThat(eventLog()).containsExactly("preInsert", "postInsert");
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("insert into ec_person");
|
||||
assertThat(sql.get(1)).contains("insert into ec_person_phone");
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("insert into ec_person");
|
||||
assertThat(sql.get(1)).contains("insert into ec_person_phone");
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql.get(0)).contains("insert into ec_person");
|
||||
assertThat(sql.get(1)).contains("insert into ec_person_phone");
|
||||
assertThat(sql.get(2)).contains("insert into ec_person_phone");
|
||||
}
|
||||
|
||||
EcPerson person1 = new EcPerson("Fiona09");
|
||||
person1.getPhoneNumbers().add("09 1234");
|
||||
@@ -121,10 +129,20 @@ public class TestElementCollectionBasic extends BaseTestCase {
|
||||
Ebean.save(bean);
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql.get(0)).contains("update ec_person set name=?, version=? where id=? and version=?");
|
||||
assertThat(sql.get(1)).contains("delete from ec_person_phone where owner_id=?");
|
||||
assertThat(sql.get(2)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql.get(0)).contains("update ec_person set name=?, version=? where id=? and version=?");
|
||||
assertThat(sql.get(1)).contains("delete from ec_person_phone where owner_id=?");
|
||||
assertThat(sql.get(2)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(5);
|
||||
assertThat(sql.get(0)).contains("update ec_person set name=?, version=? where id=? and version=?");
|
||||
assertThat(sql.get(1)).contains("delete from ec_person_phone where owner_id=?");
|
||||
assertThat(sql.get(2)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
assertThat(sql.get(3)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
assertThat(sql.get(4)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
}
|
||||
|
||||
assertThat(eventLog()).containsExactly("preUpdate", "postUpdate");
|
||||
|
||||
@@ -189,9 +207,21 @@ public class TestElementCollectionBasic extends BaseTestCase {
|
||||
Ebean.save(bean);
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("delete from ec_person_phone where owner_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("delete from ec_person_phone where owner_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(7);
|
||||
assertThat(sql.get(0)).contains("delete from ec_person_phone where owner_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
assertThat(sql.get(2)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
assertThat(sql.get(3)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
assertThat(sql.get(4)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
assertThat(sql.get(5)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
assertThat(sql.get(6)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
}
|
||||
|
||||
assertThat(eventLog()).containsExactly("preUpdate", "postUpdate");
|
||||
|
||||
|
||||
+19
-2
@@ -1,6 +1,9 @@
|
||||
package org.tests.model.elementcollection;
|
||||
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -39,7 +42,12 @@ public class TestElementCollectionBasicCache {
|
||||
Ebean.save(two);
|
||||
|
||||
sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(3);
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(3);
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(5);
|
||||
}
|
||||
|
||||
Ebean.save(two);
|
||||
|
||||
@@ -60,7 +68,12 @@ public class TestElementCollectionBasicCache {
|
||||
Ebean.save(three);
|
||||
|
||||
sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(2); // cache hit
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(2); // cache hit
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(5); // cache hit
|
||||
}
|
||||
|
||||
EcPerson four = Ebean.find(EcPerson.class)
|
||||
.setId(person.getId())
|
||||
@@ -77,4 +90,8 @@ public class TestElementCollectionBasicCache {
|
||||
|
||||
LoggedSqlCollector.stop();
|
||||
}
|
||||
|
||||
public boolean isPersistBatchOnCascade() {
|
||||
return ((SpiEbeanServer) Ebean.getDefaultServer()).getDatabasePlatform().getPersistBatchOnCascade() != PersistBatch.NONE;
|
||||
}
|
||||
}
|
||||
+40
-10
@@ -2,6 +2,8 @@ package org.tests.model.elementcollection;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -24,9 +26,17 @@ public class TestElementCollectionBasicMap extends BaseTestCase {
|
||||
Ebean.save(person);
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("insert into ecm_person");
|
||||
assertThat(sql.get(1)).contains("insert into ecm_person_phone");
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("insert into ecm_person");
|
||||
assertThat(sql.get(1)).contains("insert into ecm_person_phone");
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql.get(0)).contains("insert into ecm_person");
|
||||
assertThat(sql.get(1)).contains("insert into ecm_person_phone");
|
||||
assertThat(sql.get(2)).contains("insert into ecm_person_phone");
|
||||
}
|
||||
|
||||
EcmPerson person1 = new EcmPerson("Fiona09");
|
||||
person1.getPhoneNumbers().put("home", "09 1234");
|
||||
@@ -96,10 +106,20 @@ public class TestElementCollectionBasicMap extends BaseTestCase {
|
||||
Ebean.save(bean);
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql.get(0)).contains("update ecm_person set name=?, version=? where id=? and version=?");
|
||||
assertThat(sql.get(1)).contains("delete from ecm_person_phone_numbers where ecm_person_id=?");
|
||||
assertThat(sql.get(2)).contains("insert into ecm_person_phone_numbers (ecm_person_id,type,number) values (?,?,?)");
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql.get(0)).contains("update ecm_person set name=?, version=? where id=? and version=?");
|
||||
assertThat(sql.get(1)).contains("delete from ecm_person_phone_numbers where ecm_person_id=?");
|
||||
assertThat(sql.get(2)).contains("insert into ecm_person_phone_numbers (ecm_person_id,type,number) values (?,?,?)");
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(5);
|
||||
assertThat(sql.get(0)).contains("update ecm_person set name=?, version=? where id=? and version=?");
|
||||
assertThat(sql.get(1)).contains("delete from ecm_person_phone_numbers where ecm_person_id=?");
|
||||
assertThat(sql.get(2)).contains("insert into ecm_person_phone_numbers (ecm_person_id,type,number) values (?,?,?)");
|
||||
assertThat(sql.get(3)).contains("insert into ecm_person_phone_numbers (ecm_person_id,type,number) values (?,?,?)");
|
||||
assertThat(sql.get(4)).contains("insert into ecm_person_phone_numbers (ecm_person_id,type,number) values (?,?,?)");
|
||||
}
|
||||
|
||||
updateNothing(bean);
|
||||
}
|
||||
@@ -120,9 +140,19 @@ public class TestElementCollectionBasicMap extends BaseTestCase {
|
||||
Ebean.save(bean);
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("delete from ecm_person_phone_numbers where ecm_person_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ecm_person_phone_numbers (ecm_person_id,type,number) values (?,?,?)");
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("delete from ecm_person_phone_numbers where ecm_person_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ecm_person_phone_numbers (ecm_person_id,type,number) values (?,?,?)");
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(5);
|
||||
assertThat(sql.get(0)).contains("delete from ecm_person_phone_numbers where ecm_person_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ecm_person_phone_numbers (ecm_person_id,type,number) values (?,?,?)");
|
||||
assertThat(sql.get(2)).contains("insert into ecm_person_phone_numbers (ecm_person_id,type,number) values (?,?,?)");
|
||||
assertThat(sql.get(3)).contains("insert into ecm_person_phone_numbers (ecm_person_id,type,number) values (?,?,?)");
|
||||
assertThat(sql.get(4)).contains("insert into ecm_person_phone_numbers (ecm_person_id,type,number) values (?,?,?)");
|
||||
}
|
||||
|
||||
delete(bean);
|
||||
}
|
||||
|
||||
+19
-2
@@ -1,6 +1,9 @@
|
||||
package org.tests.model.elementcollection;
|
||||
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -41,7 +44,12 @@ public class TestElementCollectionBasicMapCache {
|
||||
Ebean.save(two);
|
||||
|
||||
sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(3);
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(3);
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(5);
|
||||
}
|
||||
|
||||
Ebean.save(two);
|
||||
|
||||
@@ -64,7 +72,12 @@ public class TestElementCollectionBasicMapCache {
|
||||
Ebean.save(three);
|
||||
|
||||
sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(2); // cache hit
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(2); // cache hit
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(3); // cache hit
|
||||
}
|
||||
|
||||
EcmPerson four = Ebean.find(EcmPerson.class)
|
||||
.setId(person.getId())
|
||||
@@ -82,4 +95,8 @@ public class TestElementCollectionBasicMapCache {
|
||||
|
||||
LoggedSqlCollector.stop();
|
||||
}
|
||||
|
||||
public boolean isPersistBatchOnCascade() {
|
||||
return ((SpiEbeanServer) Ebean.getDefaultServer()).getDatabasePlatform().getPersistBatchOnCascade() != PersistBatch.NONE;
|
||||
}
|
||||
}
|
||||
+38
-10
@@ -23,9 +23,17 @@ public class TestElementCollectionBasicSet extends BaseTestCase {
|
||||
Ebean.save(person);
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("insert into ecs_person");
|
||||
assertThat(sql.get(1)).contains("insert into ecs_person_phone");
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("insert into ecs_person");
|
||||
assertThat(sql.get(1)).contains("insert into ecs_person_phone");
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql.get(0)).contains("insert into ecs_person");
|
||||
assertThat(sql.get(1)).contains("insert into ecs_person_phone");
|
||||
assertThat(sql.get(2)).contains("insert into ecs_person_phone");
|
||||
}
|
||||
|
||||
EcsPerson person1 = new EcsPerson("Fiona09");
|
||||
person1.getPhoneNumbers().add("09 1234");
|
||||
@@ -94,10 +102,20 @@ public class TestElementCollectionBasicSet extends BaseTestCase {
|
||||
Ebean.save(bean);
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql.get(0)).contains("update ecs_person set name=?, version=? where id=? and version=?");
|
||||
assertThat(sql.get(1)).contains("delete from ecs_person_phone where ecs_person_id=?");
|
||||
assertThat(sql.get(2)).contains("insert into ecs_person_phone (ecs_person_id,phone) values (?,?)");
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql.get(0)).contains("update ecs_person set name=?, version=? where id=? and version=?");
|
||||
assertThat(sql.get(1)).contains("delete from ecs_person_phone where ecs_person_id=?");
|
||||
assertThat(sql.get(2)).contains("insert into ecs_person_phone (ecs_person_id,phone) values (?,?)");
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(5);
|
||||
assertThat(sql.get(0)).contains("update ecs_person set name=?, version=? where id=? and version=?");
|
||||
assertThat(sql.get(1)).contains("delete from ecs_person_phone where ecs_person_id=?");
|
||||
assertThat(sql.get(2)).contains("insert into ecs_person_phone (ecs_person_id,phone) values (?,?)");
|
||||
assertThat(sql.get(3)).contains("insert into ecs_person_phone (ecs_person_id,phone) values (?,?)");
|
||||
assertThat(sql.get(4)).contains("insert into ecs_person_phone (ecs_person_id,phone) values (?,?)");
|
||||
}
|
||||
|
||||
updateNothing(bean);
|
||||
}
|
||||
@@ -118,9 +136,19 @@ public class TestElementCollectionBasicSet extends BaseTestCase {
|
||||
Ebean.save(bean);
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("delete from ecs_person_phone where ecs_person_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ecs_person_phone (ecs_person_id,phone) values (?,?)");
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("delete from ecs_person_phone where ecs_person_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ecs_person_phone (ecs_person_id,phone) values (?,?)");
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(5);
|
||||
assertThat(sql.get(0)).contains("delete from ecs_person_phone where ecs_person_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ecs_person_phone (ecs_person_id,phone) values (?,?)");
|
||||
assertThat(sql.get(2)).contains("insert into ecs_person_phone (ecs_person_id,phone) values (?,?)");
|
||||
assertThat(sql.get(3)).contains("insert into ecs_person_phone (ecs_person_id,phone) values (?,?)");
|
||||
assertThat(sql.get(4)).contains("insert into ecs_person_phone (ecs_person_id,phone) values (?,?)");
|
||||
}
|
||||
|
||||
delete(bean);
|
||||
}
|
||||
|
||||
+38
-10
@@ -22,9 +22,17 @@ public class TestElementCollectionEmbeddedList extends BaseTestCase {
|
||||
Ebean.save(person);
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("insert into ecbl_person");
|
||||
assertThat(sql.get(1)).contains("insert into ecbl_person_phone_numbers");
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("insert into ecbl_person");
|
||||
assertThat(sql.get(1)).contains("insert into ecbl_person_phone_numbers");
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql.get(0)).contains("insert into ecbl_person");
|
||||
assertThat(sql.get(1)).contains("insert into ecbl_person_phone_numbers");
|
||||
assertThat(sql.get(2)).contains("insert into ecbl_person_phone_numbers");
|
||||
}
|
||||
|
||||
EcblPerson person1 = new EcblPerson("Fiona6409");
|
||||
person1.getPhoneNumbers().add(new EcPhone("61","09","1234"));
|
||||
@@ -94,10 +102,20 @@ public class TestElementCollectionEmbeddedList extends BaseTestCase {
|
||||
Ebean.save(bean);
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql.get(0)).contains("update ecbl_person set name=?, version=? where id=? and version=?");
|
||||
assertThat(sql.get(1)).contains("delete from ecbl_person_phone_numbers where person_id=?");
|
||||
assertThat(sql.get(2)).contains("insert into ecbl_person_phone_numbers (person_id,country_code,area,number) values (?,?,?,?)");
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql.get(0)).contains("update ecbl_person set name=?, version=? where id=? and version=?");
|
||||
assertThat(sql.get(1)).contains("delete from ecbl_person_phone_numbers where person_id=?");
|
||||
assertThat(sql.get(2)).contains("insert into ecbl_person_phone_numbers (person_id,country_code,area,number) values (?,?,?,?)");
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(5);
|
||||
assertThat(sql.get(0)).contains("update ecbl_person set name=?, version=? where id=? and version=?");
|
||||
assertThat(sql.get(1)).contains("delete from ecbl_person_phone_numbers where person_id=?");
|
||||
assertThat(sql.get(2)).contains("insert into ecbl_person_phone_numbers (person_id,country_code,area,number) values (?,?,?,?)");
|
||||
assertThat(sql.get(3)).contains("insert into ecbl_person_phone_numbers (person_id,country_code,area,number) values (?,?,?,?)");
|
||||
assertThat(sql.get(4)).contains("insert into ecbl_person_phone_numbers (person_id,country_code,area,number) values (?,?,?,?)");
|
||||
}
|
||||
|
||||
updateNothing(bean);
|
||||
}
|
||||
@@ -118,9 +136,19 @@ public class TestElementCollectionEmbeddedList extends BaseTestCase {
|
||||
Ebean.save(bean);
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("delete from ecbl_person_phone_numbers where person_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ecbl_person_phone_numbers (person_id,country_code,area,number) values (?,?,?,?)");
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("delete from ecbl_person_phone_numbers where person_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ecbl_person_phone_numbers (person_id,country_code,area,number) values (?,?,?,?)");
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(5);
|
||||
assertThat(sql.get(0)).contains("delete from ecbl_person_phone_numbers where person_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ecbl_person_phone_numbers (person_id,country_code,area,number) values (?,?,?,?)");
|
||||
assertThat(sql.get(2)).contains("insert into ecbl_person_phone_numbers (person_id,country_code,area,number) values (?,?,?,?)");
|
||||
assertThat(sql.get(3)).contains("insert into ecbl_person_phone_numbers (person_id,country_code,area,number) values (?,?,?,?)");
|
||||
assertThat(sql.get(4)).contains("insert into ecbl_person_phone_numbers (person_id,country_code,area,number) values (?,?,?,?)");
|
||||
}
|
||||
|
||||
delete(bean);
|
||||
}
|
||||
|
||||
+13
-3
@@ -2,6 +2,8 @@ package org.tests.model.elementcollection;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -47,9 +49,17 @@ public class TestElementCollectionEmbeddedListCache extends BaseTestCase {
|
||||
Ebean.save(two);
|
||||
|
||||
sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(2); // update of collection only
|
||||
assertThat(sql.get(0)).contains("delete from ecbl_person_phone_numbers where person_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ecbl_person_phone_numbers (person_id,country_code,area,number) values (?,?,?,?)");
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(2); // update of collection only
|
||||
assertThat(sql.get(0)).contains("delete from ecbl_person_phone_numbers where person_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ecbl_person_phone_numbers (person_id,country_code,area,number) values (?,?,?,?)");
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(3); // update of collection only
|
||||
assertThat(sql.get(0)).contains("delete from ecbl_person_phone_numbers where person_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ecbl_person_phone_numbers (person_id,country_code,area,number) values (?,?,?,?)");
|
||||
assertThat(sql.get(2)).contains("insert into ecbl_person_phone_numbers (person_id,country_code,area,number) values (?,?,?,?)");
|
||||
}
|
||||
|
||||
EcblPerson three = Ebean.find(EcblPerson.class)
|
||||
.setId(person.getId())
|
||||
|
||||
+38
-10
@@ -23,9 +23,17 @@ public class TestElementCollectionEmbeddedMap extends BaseTestCase {
|
||||
Ebean.save(person);
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("insert into ecbm_person");
|
||||
assertThat(sql.get(1)).contains("insert into ecbm_person_phone_numbers");
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("insert into ecbm_person");
|
||||
assertThat(sql.get(1)).contains("insert into ecbm_person_phone_numbers");
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql.get(0)).contains("insert into ecbm_person");
|
||||
assertThat(sql.get(1)).contains("insert into ecbm_person_phone_numbers");
|
||||
assertThat(sql.get(2)).contains("insert into ecbm_person_phone_numbers");
|
||||
}
|
||||
|
||||
EcbmPerson person1 = new EcbmPerson("Fiona6409");
|
||||
person1.getPhoneNumbers().put("home",new EcPhone("64","09","1234"));
|
||||
@@ -87,10 +95,20 @@ public class TestElementCollectionEmbeddedMap extends BaseTestCase {
|
||||
Ebean.save(bean);
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql.get(0)).contains("update ecbm_person set name=?, version=? where id=? and version=?");
|
||||
assertThat(sql.get(1)).contains("delete from ecbm_person_phone_numbers where person_id=?");
|
||||
assertThat(sql.get(2)).contains("insert into ecbm_person_phone_numbers (person_id,mkey,country_code,area,number)");
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql.get(0)).contains("update ecbm_person set name=?, version=? where id=? and version=?");
|
||||
assertThat(sql.get(1)).contains("delete from ecbm_person_phone_numbers where person_id=?");
|
||||
assertThat(sql.get(2)).contains("insert into ecbm_person_phone_numbers (person_id,mkey,country_code,area,number)");
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(5);
|
||||
assertThat(sql.get(0)).contains("update ecbm_person set name=?, version=? where id=? and version=?");
|
||||
assertThat(sql.get(1)).contains("delete from ecbm_person_phone_numbers where person_id=?");
|
||||
assertThat(sql.get(2)).contains("insert into ecbm_person_phone_numbers (person_id,mkey,country_code,area,number)");
|
||||
assertThat(sql.get(3)).contains("insert into ecbm_person_phone_numbers (person_id,mkey,country_code,area,number)");
|
||||
assertThat(sql.get(4)).contains("insert into ecbm_person_phone_numbers (person_id,mkey,country_code,area,number)");
|
||||
}
|
||||
|
||||
updateNothing(bean);
|
||||
}
|
||||
@@ -111,9 +129,19 @@ public class TestElementCollectionEmbeddedMap extends BaseTestCase {
|
||||
Ebean.save(bean);
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("delete from ecbm_person_phone_numbers where person_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ecbm_person_phone_numbers (person_id,mkey,country_code,area,number) values (?,?,?,?,?)");
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("delete from ecbm_person_phone_numbers where person_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ecbm_person_phone_numbers (person_id,mkey,country_code,area,number) values (?,?,?,?,?)");
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(5);
|
||||
assertThat(sql.get(0)).contains("delete from ecbm_person_phone_numbers where person_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ecbm_person_phone_numbers (person_id,mkey,country_code,area,number) values (?,?,?,?,?)");
|
||||
assertThat(sql.get(2)).contains("insert into ecbm_person_phone_numbers (person_id,mkey,country_code,area,number) values (?,?,?,?,?)");
|
||||
assertThat(sql.get(3)).contains("insert into ecbm_person_phone_numbers (person_id,mkey,country_code,area,number) values (?,?,?,?,?)");
|
||||
assertThat(sql.get(4)).contains("insert into ecbm_person_phone_numbers (person_id,mkey,country_code,area,number) values (?,?,?,?,?)");
|
||||
}
|
||||
|
||||
delete(bean);
|
||||
}
|
||||
|
||||
+11
-3
@@ -48,9 +48,17 @@ public class TestElementCollectionEmbeddedMapCache extends BaseTestCase {
|
||||
Ebean.save(two);
|
||||
|
||||
sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(2); // update of collection only
|
||||
assertThat(sql.get(0)).contains("delete from ecbm_person_phone_numbers where person_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ecbm_person_phone_numbers (person_id,mkey,country_code,area,number) values (?,?,?,?,?)");
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(2); // update of collection only
|
||||
assertThat(sql.get(0)).contains("delete from ecbm_person_phone_numbers where person_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ecbm_person_phone_numbers (person_id,mkey,country_code,area,number) values (?,?,?,?,?)");
|
||||
}
|
||||
else {
|
||||
assertThat(sql).hasSize(3); // update of collection only
|
||||
assertThat(sql.get(0)).contains("delete from ecbm_person_phone_numbers where person_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ecbm_person_phone_numbers (person_id,mkey,country_code,area,number) values (?,?,?,?,?)");
|
||||
assertThat(sql.get(2)).contains("insert into ecbm_person_phone_numbers (person_id,mkey,country_code,area,number) values (?,?,?,?,?)");
|
||||
}
|
||||
|
||||
EcbmPerson three = Ebean.find(EcbmPerson.class)
|
||||
.setId(person.getId())
|
||||
|
||||
Reference in new issue
Block a user