use of org.hibernate.loader.custom.NonUniqueDiscoveredSqlAliasException in project hibernate-orm by hibernate.
the class SQLTest method test_sql_hibernate_multi_entity_query_example.
@Test
public void test_sql_hibernate_multi_entity_query_example() {
try {
doInJPA(this::entityManagerFactory, entityManager -> {
Session session = entityManager.unwrap(Session.class);
List<Object> entities = session.createSQLQuery("SELECT * " + "FROM Person pr, Partner pt " + "WHERE pr.name = pt.name").list();
assertEquals(2, entities.size());
});
fail("Should throw NonUniqueDiscoveredSqlAliasException!");
} catch (NonUniqueDiscoveredSqlAliasException e) {
// expected
} catch (PersistenceException e) {
assertTyping(NonUniqueDiscoveredSqlAliasException.class, e.getCause());
}
}
Aggregations