*Fix indentation

This commit is contained in:
zepfred 2020-01-05 13:11:07 -03:00
parent 195ab64929
commit 4955a87440
4 changed files with 7 additions and 9 deletions

View File

@ -10,10 +10,7 @@ public class Employee {
private int id; private int id;
private String name; private String name;
@ElementCollection @ElementCollection
@CollectionTable( @CollectionTable(name = "employee_phone", joinColumns = @JoinColumn(name = "employee_id"))
name = "employee_phone",
joinColumns = @JoinColumn(name = "employee_id")
)
private List<Phone> phones; private List<Phone> phones;
public Employee() { public Employee() {

View File

@ -51,9 +51,8 @@ public class Phone {
return false; return false;
} }
Phone phone = (Phone) o; Phone phone = (Phone) o;
return getType().equals(phone.getType()) && return getType().equals(phone.getType()) && getAreaCode().equals(phone.getAreaCode())
getAreaCode().equals(phone.getAreaCode()) && && getNumber().equals(phone.getNumber());
getNumber().equals(phone.getNumber());
} }
@Override @Override

View File

@ -32,7 +32,8 @@ public class EmployeeRepository {
} }
public Employee findByJPQL(int id) { 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) { public Employee findByEntityGraph(int id) {

View File

@ -27,7 +27,8 @@ public class ElementCollectionIntegrationTest {
@Before @Before
public void init() { public void init() {
Employee employee = new Employee(1, "Fred"); 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); employeeRepository.save(employee);
} }