mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-29 07:29:56 +00:00
Tidy up test - TestInfoOneToOne, oneToOne cascade update
This commit is contained in:
1 parent
306cc4adf4
commit
0f3b1eb812
3 files changed
+9
-10
No files matched your search
@@ -544,7 +544,7 @@ public interface EbeanServer {
|
|||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public SqlFutureList findFutureList(SqlQuery query, Transaction transaction);
|
public SqlFutureList findFutureList(SqlQuery query, Transaction transaction);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find using a PagingList with explicit transaction and pageSize.
|
* Find using a PagingList with explicit transaction and pageSize.
|
||||||
* Deprecated in favour of findPagedList().
|
* Deprecated in favour of findPagedList().
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class TestInfoOneToOne extends BaseTestCase {
|
|||||||
|
|
||||||
InfoCustomer customer = new InfoCustomer();
|
InfoCustomer customer = new InfoCustomer();
|
||||||
customer.setName("first info cust");
|
customer.setName("first info cust");
|
||||||
customer.setInfos(company);
|
customer.setCompany(company);
|
||||||
|
|
||||||
customer.save();
|
customer.save();
|
||||||
|
|
||||||
@@ -34,13 +34,13 @@ public class TestInfoOneToOne extends BaseTestCase {
|
|||||||
customer.update();
|
customer.update();
|
||||||
|
|
||||||
// update the customer and company
|
// update the customer and company
|
||||||
customer.getInfos().setName("2nd mod company");
|
customer.getCompany().setName("2nd mod company");
|
||||||
customer.setName("2nd mod customer");
|
customer.setName("2nd mod customer");
|
||||||
customer.update();
|
customer.update();
|
||||||
|
|
||||||
// fetch and then update both
|
// fetch and then update both
|
||||||
InfoCustomer fetchedCustomer = InfoCustomer.find.byId(customer.getId());
|
InfoCustomer fetchedCustomer = InfoCustomer.find.byId(customer.getId());
|
||||||
fetchedCustomer.getInfos().setName("3rd mod company");
|
fetchedCustomer.getCompany().setName("3rd mod company");
|
||||||
fetchedCustomer.setName("3rd mod customer");
|
fetchedCustomer.setName("3rd mod customer");
|
||||||
fetchedCustomer.update();
|
fetchedCustomer.update();
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ public class InfoCustomer extends Model {
|
|||||||
String name;
|
String name;
|
||||||
|
|
||||||
@OneToOne(cascade = CascadeType.ALL)
|
@OneToOne(cascade = CascadeType.ALL)
|
||||||
//@JoinColumn(name = "id_info_company")
|
InfoCompany company;
|
||||||
InfoCompany infos = new InfoCompany();
|
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
@@ -45,11 +44,11 @@ public class InfoCustomer extends Model {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InfoCompany getInfos() {
|
public InfoCompany getCompany() {
|
||||||
return infos;
|
return company;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInfos(InfoCompany infos) {
|
public void setCompany(InfoCompany company) {
|
||||||
this.infos = infos;
|
this.company = company;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user