diff --git a/hibernate-public-fields/src/main/java/de/codecentric/demo/simple/value/objects/hibernate/entities/Company.java b/hibernate-public-fields/src/main/java/de/codecentric/demo/simple/value/objects/hibernate/entities/Company.java index 11cf68d..10db0e5 100755 --- a/hibernate-public-fields/src/main/java/de/codecentric/demo/simple/value/objects/hibernate/entities/Company.java +++ b/hibernate-public-fields/src/main/java/de/codecentric/demo/simple/value/objects/hibernate/entities/Company.java @@ -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; @@ -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 customers; + public Set customers; } diff --git a/hibernate-public-fields/src/test/java/de/codecentric/demo/simple/value/objects/hibernate/HibernatePublicFieldsTest.java b/hibernate-public-fields/src/test/java/de/codecentric/demo/simple/value/objects/hibernate/HibernatePublicFieldsTest.java index 5e9b42c..5ad5e05 100755 --- a/hibernate-public-fields/src/test/java/de/codecentric/demo/simple/value/objects/hibernate/HibernatePublicFieldsTest.java +++ b/hibernate-public-fields/src/test/java/de/codecentric/demo/simple/value/objects/hibernate/HibernatePublicFieldsTest.java @@ -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; @@ -76,7 +78,7 @@ private Company createCompany() { company.name = "Example Inc."; company.companyAddress = companyAddress; - List customers = new ArrayList<>(); + Set customers = new HashSet<>(); for (int i = 0; i < 5; i++) { Customer customer = new Customer(); customer.firstName = UUID.randomUUID().toString();