diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/CompanyWithFetchProfile.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/CompanyFetchProfile.java similarity index 90% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/CompanyWithFetchProfile.java rename to hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/CompanyFetchProfile.java index b5394e7dce..8b13e2e53a 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/CompanyWithFetchProfile.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/CompanyFetchProfile.java @@ -22,13 +22,13 @@ import java.util.Set; name = "company.location", fetchOverrides = { @FetchProfile.FetchOverride( - entity = CompanyWithFetchProfile.class, + entity = CompanyFetchProfile.class, association = "location", mode = FetchMode.JOIN ) } ) -public class CompanyWithFetchProfile { +public class CompanyFetchProfile { @Id @GeneratedValue public long id; @@ -42,6 +42,7 @@ public class CompanyWithFetchProfile { public Set markets = new HashSet(); @ElementCollection(fetch = FetchType.EAGER) + @JoinTable(name= "companyfp_phonenos") public Set phoneNumbers = new HashSet(); public Location getLocation() { diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/mapped_by_id/FetchGraphFindByIdTest.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/mappedbyid/FetchGraphFindByIdTest.java similarity index 85% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/mapped_by_id/FetchGraphFindByIdTest.java rename to hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/mappedbyid/FetchGraphFindByIdTest.java index 88818d7663..31f7394901 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/mapped_by_id/FetchGraphFindByIdTest.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/mappedbyid/FetchGraphFindByIdTest.java @@ -1,4 +1,4 @@ -package org.hibernate.jpa.test.graphs.mapped_by_id; +package org.hibernate.jpa.test.graphs.mappedbyid; import org.hibernate.Hibernate; import org.hibernate.Session; @@ -99,12 +99,12 @@ public class FetchGraphFindByIdTest extends BaseEntityManagerFunctionalTestCase entityManager.unwrap( Session.class ).enableFetchProfile("company.location"); - EntityGraph entityGraph = entityManager.createEntityGraph( CompanyWithFetchProfile.class ); + EntityGraph entityGraph = entityManager.createEntityGraph( CompanyFetchProfile.class ); entityGraph.addAttributeNodes( "markets" ); Map properties = Collections.singletonMap( "javax.persistence.fetchgraph", entityGraph ); - CompanyWithFetchProfile company = entityManager.find( CompanyWithFetchProfile.class, companyWithFetchProfileId, properties ); + CompanyFetchProfile company = entityManager.find( CompanyFetchProfile.class, companyWithFetchProfileId, properties ); entityManager.getTransaction().commit(); entityManager.close(); @@ -126,7 +126,7 @@ public class FetchGraphFindByIdTest extends BaseEntityManagerFunctionalTestCase subSubgraph.addAttributeNodes( "managers" ); subSubgraph.addAttributeNodes( "friends" ); - company = entityManager.find( CompanyWithFetchProfile.class, companyWithFetchProfileId, properties ); + company = entityManager.find( CompanyFetchProfile.class, companyWithFetchProfileId, properties ); entityManager.getTransaction().commit(); entityManager.close(); @@ -189,17 +189,17 @@ public class FetchGraphFindByIdTest extends BaseEntityManagerFunctionalTestCase entityManager.persist( company ); companyId = company.id; - CompanyWithFetchProfile companyWithFetchProfile = new CompanyWithFetchProfile(); - companyWithFetchProfile.employees.add( employee ); - companyWithFetchProfile.employees.add( manager1 ); - companyWithFetchProfile.employees.add( manager2 ); - companyWithFetchProfile.location = location; - companyWithFetchProfile.markets.add( Market.SERVICES ); - companyWithFetchProfile.markets.add( Market.TECHNOLOGY ); - companyWithFetchProfile.phoneNumbers.add( "012-345-6789" ); - companyWithFetchProfile.phoneNumbers.add( "987-654-3210" ); - entityManager.persist( companyWithFetchProfile ); - companyWithFetchProfileId = companyWithFetchProfile.id; + CompanyFetchProfile companyFetchProfile = new CompanyFetchProfile(); + companyFetchProfile.employees.add( employee ); + companyFetchProfile.employees.add( manager1 ); + companyFetchProfile.employees.add( manager2 ); + companyFetchProfile.location = location; + companyFetchProfile.markets.add( Market.SERVICES ); + companyFetchProfile.markets.add( Market.TECHNOLOGY ); + companyFetchProfile.phoneNumbers.add( "012-345-6789" ); + companyFetchProfile.phoneNumbers.add( "987-654-3210" ); + entityManager.persist( companyFetchProfile ); + companyWithFetchProfileId = companyFetchProfile.id; entityManager.getTransaction().commit(); entityManager.close(); @@ -207,7 +207,7 @@ public class FetchGraphFindByIdTest extends BaseEntityManagerFunctionalTestCase @Override protected Class[] getAnnotatedClasses() { - return new Class[] { Company.class, CompanyWithFetchProfile.class, Employee.class, Manager.class, Location.class, Course.class, Student.class }; + return new Class[] { Company.class, CompanyFetchProfile.class, Employee.class, Manager.class, Location.class, Course.class, Student.class }; } } diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/mapped_by_id/LoadGraphFindByIdTest.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/mappedbyid/LoadGraphFindByIdTest.java similarity index 98% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/mapped_by_id/LoadGraphFindByIdTest.java rename to hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/mappedbyid/LoadGraphFindByIdTest.java index 2f160233d7..cec8e85db3 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/mapped_by_id/LoadGraphFindByIdTest.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/mappedbyid/LoadGraphFindByIdTest.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.graphs.mapped_by_id; +package org.hibernate.jpa.test.graphs.mappedbyid; import java.util.HashMap; import java.util.Map; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/queryhint/QueryHintEntityGraphTest.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/queryhint/QueryHintEntityGraphTest.java index e5e1b45a1d..bfb7f3c66f 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/queryhint/QueryHintEntityGraphTest.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/queryhint/QueryHintEntityGraphTest.java @@ -175,11 +175,11 @@ public class QueryHintEntityGraphTest extends BaseEntityManagerFunctionalTestCas entityManager.unwrap( Session.class ).enableFetchProfile( "company.location" ); - EntityGraph entityGraph = entityManager.createEntityGraph( CompanyWithFetchProfile.class ); + EntityGraph entityGraph = entityManager.createEntityGraph( CompanyFetchProfile.class ); entityGraph.addAttributeNodes( "markets" ); - Query query = entityManager.createQuery( "from " + CompanyWithFetchProfile.class.getName() ); + Query query = entityManager.createQuery( "from " + CompanyFetchProfile.class.getName() ); query.setHint( QueryHints.HINT_FETCHGRAPH, entityGraph ); - CompanyWithFetchProfile company = (CompanyWithFetchProfile) query.getSingleResult(); + CompanyFetchProfile company = (CompanyFetchProfile) query.getSingleResult(); entityManager.getTransaction().commit(); entityManager.close(); @@ -201,9 +201,9 @@ public class QueryHintEntityGraphTest extends BaseEntityManagerFunctionalTestCas subSubgraph.addAttributeNodes( "managers" ); subSubgraph.addAttributeNodes( "friends" ); - query = entityManager.createQuery( "from " + CompanyWithFetchProfile.class.getName() ); + query = entityManager.createQuery( "from " + CompanyFetchProfile.class.getName() ); query.setHint( QueryHints.HINT_FETCHGRAPH, entityGraph ); - company = (CompanyWithFetchProfile) query.getSingleResult(); + company = (CompanyFetchProfile) query.getSingleResult(); entityManager.getTransaction().commit(); entityManager.close(); @@ -508,16 +508,16 @@ public class QueryHintEntityGraphTest extends BaseEntityManagerFunctionalTestCas company.phoneNumbers.add( "987-654-3210" ); entityManager.persist( company ); - CompanyWithFetchProfile companyWithFetchProfile = new CompanyWithFetchProfile(); - companyWithFetchProfile.employees.add( employee ); - companyWithFetchProfile.employees.add( manager1 ); - companyWithFetchProfile.employees.add( manager2 ); - companyWithFetchProfile.location = location; - companyWithFetchProfile.markets.add( Market.SERVICES ); - companyWithFetchProfile.markets.add( Market.TECHNOLOGY ); - companyWithFetchProfile.phoneNumbers.add( "012-345-6789" ); - companyWithFetchProfile.phoneNumbers.add( "987-654-3210" ); - entityManager.persist( companyWithFetchProfile ); + CompanyFetchProfile companyFetchProfile = new CompanyFetchProfile(); + companyFetchProfile.employees.add( employee ); + companyFetchProfile.employees.add( manager1 ); + companyFetchProfile.employees.add( manager2 ); + companyFetchProfile.location = location; + companyFetchProfile.markets.add( Market.SERVICES ); + companyFetchProfile.markets.add( Market.TECHNOLOGY ); + companyFetchProfile.phoneNumbers.add( "012-345-6789" ); + companyFetchProfile.phoneNumbers.add( "987-654-3210" ); + entityManager.persist( companyFetchProfile ); entityManager.getTransaction().commit(); entityManager.close(); @@ -525,6 +525,6 @@ public class QueryHintEntityGraphTest extends BaseEntityManagerFunctionalTestCas @Override protected Class[] getAnnotatedClasses() { - return new Class[] { Company.class, CompanyWithFetchProfile.class, Employee.class, Manager.class, Location.class, Course.class, Student.class }; + return new Class[] { Company.class, CompanyFetchProfile.class, Employee.class, Manager.class, Location.class, Course.class, Student.class }; } }