HHH-12871 - Fix test that uses dynamic-map entities which failed.

This commit is contained in:
Chris Cranford 2018-08-07 09:30:38 -04:00
parent b9e0449602
commit 8bd79b29cf
1 changed files with 96 additions and 85 deletions

View File

@ -6,6 +6,8 @@
*/ */
package org.hibernate.jpa.test.criteria.paths; package org.hibernate.jpa.test.criteria.paths;
import java.util.Map;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.TypedQuery; import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaBuilder;
@ -18,6 +20,7 @@ import javax.persistence.metamodel.Bindable;
import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.Type; import javax.persistence.metamodel.Type;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
import org.hibernate.query.criteria.internal.CriteriaBuilderImpl; import org.hibernate.query.criteria.internal.CriteriaBuilderImpl;
import org.hibernate.query.criteria.internal.PathSource; import org.hibernate.query.criteria.internal.PathSource;
@ -41,6 +44,14 @@ public class SingularAttributeJoinTest extends BaseEntityManagerFunctionalTestCa
}; };
} }
@Override
protected void addConfigOptions(Map options) {
super.addConfigOptions( options );
// make sure that dynamic-map mode entity types are returned in the metamodel.
options.put( AvailableSettings.JPA_METAMODEL_POPULATION, "enabled" );
}
/** /**
* When building a join from a non-class based entity (EntityMode.MAP), make sure you get the Bindable from * When building a join from a non-class based entity (EntityMode.MAP), make sure you get the Bindable from
* the SingularAttribute as the join model. If you don't, you'll get the first non-classed based entity * the SingularAttribute as the join model. If you don't, you'll get the first non-classed based entity