mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#907 - Remove Model.Finder ... migrate to Finder
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.avaje.tests.model.info;
|
||||
|
||||
import com.avaje.ebean.Finder;
|
||||
import com.avaje.ebean.Model;
|
||||
import com.avaje.ebean.annotation.JsonIgnore;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.avaje.tests.model.info;
|
||||
|
||||
import com.avaje.ebean.Finder;
|
||||
import com.avaje.ebean.Model;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.avaje.tests.model.onetoone;
|
||||
|
||||
import com.avaje.ebean.Finder;
|
||||
import com.avaje.tests.model.BaseModel;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
@@ -10,8 +11,7 @@ import javax.persistence.Table;
|
||||
@Table(name = "oto_account")
|
||||
public class Account extends BaseModel {
|
||||
|
||||
public static final Find<Long, Account> find = new Find<Long, Account>() {
|
||||
};
|
||||
public static final Finder<Long, Account> find = new Finder<>(Account.class);
|
||||
|
||||
String name;
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ public class TestOneToOneOptionalRelationship extends BaseTestCase {
|
||||
|
||||
LoggedSqlCollector.start();
|
||||
|
||||
Account fetchedAccount = Account.find.fetch("user").setId(account.getId()).findUnique();
|
||||
Account fetchedAccount = Account.find.query().fetch("user").setId(account.getId()).findUnique();
|
||||
Assert.assertNotNull(fetchedAccount);
|
||||
|
||||
Assert.assertNotNull(fetchedAccount.getUser());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.avaje.tests.model.onetoone;
|
||||
|
||||
import com.avaje.ebean.Finder;
|
||||
import com.avaje.tests.model.BaseModel;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
@@ -10,8 +11,7 @@ import javax.persistence.Table;
|
||||
@Table(name = "oto_user")
|
||||
public class User extends BaseModel {
|
||||
|
||||
public static final Find<Long, User> find = new Find<Long, User>() {
|
||||
};
|
||||
public static final Finder<Long, User> find = new Finder<>(User.class);
|
||||
|
||||
String name;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.avaje.tests.model.onetoone.album;
|
||||
|
||||
import com.avaje.ebean.Model;
|
||||
import com.avaje.ebean.Finder;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
@@ -10,7 +10,7 @@ import javax.persistence.OneToOne;
|
||||
@Entity
|
||||
public class Album extends BaseModel {
|
||||
|
||||
public static final Model.Finder<Long, Album> find = new Model.Finder<>(Album.class);
|
||||
public static final Finder<Long, Album> find = new Finder<>(Album.class);
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.avaje.tests.model.onetoone.album;
|
||||
|
||||
import com.avaje.ebean.Finder;
|
||||
import com.avaje.ebean.Model;
|
||||
import com.avaje.ebean.annotation.SoftDelete;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -23,7 +23,7 @@ public class TestOneToOneHardDelete extends BaseTestCase {
|
||||
album.setCover(cover);
|
||||
album.save();
|
||||
|
||||
Album found1 = Album.find.where().findUnique();
|
||||
Album found1 = Album.find.byId(album.getId());
|
||||
|
||||
LoggedSqlCollector.start();
|
||||
|
||||
@@ -40,7 +40,7 @@ public class TestOneToOneHardDelete extends BaseTestCase {
|
||||
assertThat(sql.get(1)).contains("update album set deleted=?, last_update=? where id=?");
|
||||
assertThat(sql.get(2)).contains("update cover set deleted=? where id=?");
|
||||
|
||||
Album found2 = Album.find.where().setIncludeSoftDeletes().findUnique();
|
||||
Album found2 = Album.find.query().setId(album.getId()).setIncludeSoftDeletes().findUnique();
|
||||
|
||||
LoggedSqlCollector.start();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user