use of org.hibernate.query.criteria.internal.PathSource in project hibernate-orm by hibernate.
the class SingularAttributeJoinTest method testEntityModeMapJoins.
/**
* 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
* you added to your configuration. Regression for HHH-9142.
*/
@Test
public void testEntityModeMapJoins() throws Exception {
CriteriaBuilderImpl criteriaBuilder = mock(CriteriaBuilderImpl.class);
PathSource pathSource = mock(PathSource.class);
SingularAttribute joinAttribute = mock(SingularAttribute.class);
when(joinAttribute.getPersistentAttributeType()).thenReturn(Attribute.PersistentAttributeType.MANY_TO_ONE);
Type joinType = mock(Type.class, withSettings().extraInterfaces(Bindable.class));
when(joinAttribute.getType()).thenReturn(joinType);
SingularAttributeJoin join = new SingularAttributeJoin(criteriaBuilder, null, pathSource, joinAttribute, JoinType.LEFT);
assertEquals(joinType, join.getModel());
}
Aggregations