# Hibernate 6 HQL join without ON clause does not work

**URL:** <https://discourse.hibernate.org/t/hibernate-6-hql-join-without-on-clause-does-not-work/12182>\
**Category:** Hibernate ORM\
**Created:** [March 14, 2026, 8:40am UTC](https://discourse.hibernate.org/t/hibernate-6-hql-join-without-on-clause-does-not-work/12182 "2026-03-14T08:40:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinhbqu](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/vinhbqu/32/4290_2.png) [@vinhbqu](https://discourse.hibernate.org/u/vinhbqu)\
**Post date:** [March 14, 2026, 8:40am UTC](https://discourse.hibernate.org/t/hibernate-6-hql-join-without-on-clause-does-not-work/12182/1 "2026-03-14T08:40:11Z")

</div>

I am migrating the project from Hibernate 5 to 6. Given the entities defined like this

```auto
@Entity
@Table(name = "person")
public class Person extends Basic {
    @OneToOne
    @JoinColumn(name = "person_house_objectId", foreignKey = @ForeignKey(name = "fk_person_house_objectId"))
    private House house;
}

@Entity
@Table(name = "house")
public class House extends Basic {
}

```

There are multiple places in the project having join HQL queries like this

```auto
entityManagerFactory.createEntityManager().createQuery("select c from Person c join House s where c.id = '123123' ").getResultList()

```

where there is no ON clause specified. It worked with Hibernate 5.x but in version 6.1.0 Final, it generated this SQL query

```auto
select
        p1_0.objectId,
        p1_0.person_house_objectId,
        p1_0.person_land_objectId,
        p1_0.name 
    from
        person p1_0 
    join
        house h1_0 
            on true 
    where
        p1_0.objectId='123123'

```

I expect that there is an ON clause generated for this query.  
when I tried with version 6.6.37.Final, I got the error:

```auto
Caused by: org.hibernate.query.SemanticException: Entity join did not specify a join condition [SqmEntityJoin(org.hibernate.bugs.pojo2.House(s))] (specify a join condition with 'on' or use 'cross join')
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.consumeEntityJoin(BaseSqmToSqlAstConverter.java:3552)
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.consumeExplicitJoin(BaseSqmToSqlAstConverter.java:3298)
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.consumeJoins(BaseSqmToSqlAstConverter.java:2907)
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.consumeFromClauseRoot(BaseSqmToSqlAstConverter.java:2841)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
	at org.hibernate.query.sqm.tree.from.SqmFromClause.visitRoots(SqmFromClause.java:81)
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitFromClause(BaseSqmToSqlAstConverter.java:2584)
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitQuerySpec(BaseSqmToSqlAstConverter.java:2090)
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitQuerySpec(BaseSqmToSqlAstConverter.java:454)
	at org.hibernate.query.sqm.tree.select.SqmQuerySpec.accept(SqmQuerySpec.java:124)
	at org.hibernate.query.sqm.spi.BaseSemanticQueryWalker.visitQueryPart(BaseSemanticQueryWalker.java:245)
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitQueryPart(BaseSqmToSqlAstConverter.java:1946)
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitSelectStatement(BaseSqmToSqlAstConverter.java:1629)
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitSelectStatement(BaseSqmToSqlAstConverter.java:454)
	at org.hibernate.query.sqm.tree.select.SqmSelectStatement.accept(SqmSelectStatement.java:238)
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.translate(BaseSqmToSqlAstConverter.java:800)
	at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.buildCacheableSqmInterpretation(ConcreteSqmSelectQueryPlan.java:479)
	at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.withCacheableSqmInterpretation(ConcreteSqmSelectQueryPlan.java:385)
	at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.performList(ConcreteSqmSelectQueryPlan.java:359)
	at org.hibernate.query.sqm.internal.QuerySqmImpl.doList(QuerySqmImpl.java:380)
	at org.hibernate.query.spi.AbstractSelectionQuery.list(AbstractSelectionQuery.java:143)

```

I did not find it mention that HQL does require specifying ON clause for associated entities. Or my entity configuration is wrong?

---

<div class="post-metadata">

**Author:** ![vinhbqu](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/vinhbqu/32/4290_2.png) [@vinhbqu](https://discourse.hibernate.org/u/vinhbqu)\
**Post date:** [March 15, 2026, 1:04pm UTC](https://discourse.hibernate.org/t/hibernate-6-hql-join-without-on-clause-does-not-work/12182/2 "2026-03-15T13:04:11Z")

</div>

Just found out that I wrote the test incorrectly  
The query should have been

```auto
select c from Person c join c.house where c.id = '123123' 

```

and it is working as expected.

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [March 16, 2026, 9:25am UTC](https://discourse.hibernate.org/t/hibernate-6-hql-join-without-on-clause-does-not-work/12182/3 "2026-03-16T09:25:27Z")

</div>

Entity joins generally always require that you specify an `ON` clause. If you want to join everything, that’s called a cross join, so you’d use `select c from Person c cross join House s where c.id = '123123'`, but seriously, why would anyone want to do that?
