Skip to content

Commit

Permalink
Module hibernate-public-fields: change a list of customers into a set
Browse files Browse the repository at this point in the history
  • Loading branch information
s7nio committed Feb 16, 2016
1 parent a5ea737 commit cd6eaa3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.codecentric.demo.simple.value.objects.hibernate.entities;

import java.io.Serializable;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
Expand All @@ -15,5 +15,5 @@ public class Company extends BaseEntity implements Serializable {
public String name;
public Address companyAddress;
@OneToMany(mappedBy = "company", cascade = CascadeType.ALL)
public List<Customer> customers;
public Set<Customer> customers;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import static org.junit.Assert.assertNotNull;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;

import javax.persistence.EntityManager;
Expand Down Expand Up @@ -76,7 +78,7 @@ private Company createCompany() {
company.name = "Example Inc.";
company.companyAddress = companyAddress;

List<Customer> customers = new ArrayList<>();
Set<Customer> customers = new HashSet<>();
for (int i = 0; i < 5; i++) {
Customer customer = new Customer();
customer.firstName = UUID.randomUUID().toString();
Expand Down

0 comments on commit cd6eaa3

Please sign in to comment.