mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Merge remote-tracking branch 'ebean/master'
This commit is contained in:
@@ -25,6 +25,10 @@ public class EBasicVer {
|
||||
@Version
|
||||
Timestamp lastUpdate;
|
||||
|
||||
public EBasicVer(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ResetBasicData {
|
||||
|
||||
server.execute(new TxRunnable() {
|
||||
public void run() {
|
||||
if (server.find(Product.class).findRowCount() > 0) {
|
||||
if (server.find(Product.class).findCount() > 0) {
|
||||
// we can't really delete this base data as
|
||||
// the test rely on the products being in there
|
||||
return;
|
||||
@@ -72,7 +72,7 @@ public class ResetBasicData {
|
||||
|
||||
public void insertCountries() {
|
||||
|
||||
if (server.find(Country.class).findRowCount() > 0) {
|
||||
if (server.find(Country.class).findCount() > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ public class ResetBasicData {
|
||||
|
||||
public void insertProducts() {
|
||||
|
||||
if (server.find(Product.class).findRowCount() > 0) {
|
||||
if (server.find(Product.class).findCount() > 0) {
|
||||
return;
|
||||
}
|
||||
server.execute(new TxRunnable() {
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.junit.Test;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class TestInsertBatchThenUpdate extends BaseTestCase {
|
||||
@@ -24,6 +25,8 @@ public class TestInsertBatchThenUpdate extends BaseTestCase {
|
||||
try {
|
||||
txn.setBatch(PersistBatch.ALL);
|
||||
|
||||
LoggedSqlCollector.start();
|
||||
|
||||
EdParent parent = new EdParent();
|
||||
parent.setName("MyComputer");
|
||||
|
||||
@@ -36,21 +39,17 @@ public class TestInsertBatchThenUpdate extends BaseTestCase {
|
||||
|
||||
Ebean.save(parent);
|
||||
|
||||
// nothing flushed yet
|
||||
List<String> loggedSql0 = LoggedSqlCollector.start();
|
||||
assertEquals(0, loggedSql0.size());
|
||||
|
||||
parent.setName("MyDesk");
|
||||
Ebean.save(parent);
|
||||
|
||||
// nothing flushed yet
|
||||
assertEquals(0, LoggedSqlCollector.start().size());
|
||||
|
||||
Ebean.commitTransaction();
|
||||
|
||||
// insert statements for EdExtendedParent
|
||||
List<String> loggedSql2 = LoggedSqlCollector.start();
|
||||
assertEquals(2, loggedSql2.size());
|
||||
List<String> loggedSql = LoggedSqlCollector.stop();
|
||||
assertEquals(3, loggedSql.size());
|
||||
assertThat(loggedSql.get(0)).contains("insert into td_parent");
|
||||
assertThat(loggedSql.get(1)).contains("insert into td_child ");
|
||||
assertThat(loggedSql.get(2)).contains("update td_parent set parent_name=? where parent_id=?");
|
||||
|
||||
} finally {
|
||||
Ebean.endTransaction();
|
||||
|
||||
@@ -19,6 +19,13 @@ public class MnyB extends BaseModel {
|
||||
@ManyToMany(cascade = CascadeType.REMOVE)
|
||||
List<MnyC> cs;
|
||||
|
||||
public MnyB(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public MnyB() {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class TestInsertNoIdBean extends BaseTestCase {
|
||||
|
||||
Ebean.save(bean);
|
||||
|
||||
int rowCount = Ebean.find(NoIdBean.class).findRowCount();
|
||||
int rowCount = Ebean.find(NoIdBean.class).findCount();
|
||||
|
||||
assertTrue("rowCount:"+rowCount, rowCount > 0);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public class TestTextJsonSelfRef extends BaseTestCase {
|
||||
Ebean.execute(new TxRunnable() {
|
||||
public void run() {
|
||||
|
||||
if (Ebean.find(SelfRefCustomer.class).findRowCount() == 0) {
|
||||
if (Ebean.find(SelfRefCustomer.class).findCount() == 0) {
|
||||
SelfRefCustomer c1 = new SelfRefCustomer();
|
||||
c1.setName("Foo");
|
||||
c1.setReferredBy(c1);
|
||||
|
||||
Reference in New Issue
Block a user