*Fix indentation
This commit is contained in:
parent
195ab64929
commit
4955a87440
@ -10,10 +10,7 @@ public class Employee {
|
||||
private int id;
|
||||
private String name;
|
||||
@ElementCollection
|
||||
@CollectionTable(
|
||||
name = "employee_phone",
|
||||
joinColumns = @JoinColumn(name = "employee_id")
|
||||
)
|
||||
@CollectionTable(name = "employee_phone", joinColumns = @JoinColumn(name = "employee_id"))
|
||||
private List<Phone> phones;
|
||||
|
||||
public Employee() {
|
||||
|
@ -51,9 +51,8 @@ public class Phone {
|
||||
return false;
|
||||
}
|
||||
Phone phone = (Phone) o;
|
||||
return getType().equals(phone.getType()) &&
|
||||
getAreaCode().equals(phone.getAreaCode()) &&
|
||||
getNumber().equals(phone.getNumber());
|
||||
return getType().equals(phone.getType()) && getAreaCode().equals(phone.getAreaCode())
|
||||
&& getNumber().equals(phone.getNumber());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,7 +32,8 @@ public class EmployeeRepository {
|
||||
}
|
||||
|
||||
public Employee findByJPQL(int id) {
|
||||
return em.createQuery("SELECT u FROM Employee AS u JOIN FETCH u.phones WHERE u.id=:id", Employee.class).setParameter("id", id).getSingleResult();
|
||||
return em.createQuery("SELECT u FROM Employee AS u JOIN FETCH u.phones WHERE u.id=:id", Employee.class)
|
||||
.setParameter("id", id).getSingleResult();
|
||||
}
|
||||
|
||||
public Employee findByEntityGraph(int id) {
|
||||
|
@ -27,7 +27,8 @@ public class ElementCollectionIntegrationTest {
|
||||
@Before
|
||||
public void init() {
|
||||
Employee employee = new Employee(1, "Fred");
|
||||
employee.setPhones(Arrays.asList(new Phone("work", "+55", "99999-9999"), new Phone("home", "+55", "98888-8888")));
|
||||
employee.setPhones(
|
||||
Arrays.asList(new Phone("work", "+55", "99999-9999"), new Phone("home", "+55", "98888-8888")));
|
||||
employeeRepository.save(employee);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user