Merge pull request #1948 from ebean-orm/feature/queryUsingDatabase

ENH: Add query.usingDatabase(database)
This commit is contained in:
Rob Bygrave
2020-02-20 16:42:25 +13:00
committed by GitHub
5 changed files with 67 additions and 3 deletions
@@ -2,6 +2,7 @@ package org.tests.basic;
import io.ebean.BaseTestCase;
import io.ebean.DB;
import io.ebean.Database;
import io.ebean.Transaction;
import io.ebean.annotation.IgnorePlatform;
import io.ebean.annotation.Platform;
@@ -18,6 +19,21 @@ import static org.junit.Assert.assertEquals;
public class TestQueryUsingConnection extends BaseTestCase {
@Test
public void usingDatabase() {
ResetBasicData.reset();
final Database database = DB.getDefault();
int count =
DB.find(Country.class)
.usingDatabase(database)
.findCount();
assertThat(count).isGreaterThan(0);
}
@Test
public void usingConnection() throws SQLException {