HHH-13856 Fix Oracle failing tests

This commit is contained in:
Andrea Boriero 2020-02-09 11:52:12 +00:00
parent 39091fc658
commit 5defe54d31
4 changed files with 36 additions and 35 deletions

View File

@ -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<Market> markets = new HashSet<Market>();
@ElementCollection(fetch = FetchType.EAGER)
@JoinTable(name= "companyfp_phonenos")
public Set<String> phoneNumbers = new HashSet<String>();
public Location getLocation() {

View File

@ -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<CompanyWithFetchProfile> entityGraph = entityManager.createEntityGraph( CompanyWithFetchProfile.class );
EntityGraph<CompanyFetchProfile> entityGraph = entityManager.createEntityGraph( CompanyFetchProfile.class );
entityGraph.addAttributeNodes( "markets" );
Map<String, Object> 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 };
}
}

View File

@ -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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.jpa.test.graphs.mapped_by_id;
package org.hibernate.jpa.test.graphs.mappedbyid;
import java.util.HashMap;
import java.util.Map;

View File

@ -175,11 +175,11 @@ public class QueryHintEntityGraphTest extends BaseEntityManagerFunctionalTestCas
entityManager.unwrap( Session.class ).enableFetchProfile( "company.location" );
EntityGraph<CompanyWithFetchProfile> entityGraph = entityManager.createEntityGraph( CompanyWithFetchProfile.class );
EntityGraph<CompanyFetchProfile> 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 };
}
}