Thanks for the reply, Christian.
When I try to do
FULL JOINS I always get
Code:
an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: undefined join type 23
Yes, I have read section 14.3 many times and oh, how I yearn for things to work that way. Hibernate has been a truly excellent technology for us in every other respect.
I have been successful in using LEFT and RIGHT outer joins while joining 3 or more tables. I've combined that with various WHERE and ORDER BY clauses. I hope this convinces you that I have worked hard to understand the syntax of HQL and that I have had a lot of success using it in nontrivial queries.
Please also notice an earlier post matter of factly saying
Quote:
no, full joins don't work.
My database is PostgreSQL 8.0.3. Its documentation claims it can do full joins. At this point, I don't believe anything I read so I tried running full joins with manually entered queries. I confirmed that PostgreSQL 8.0.3 does indeed do full joins.
I started to think that maybe the way for me would be to use session.createSqlQuery instead of session.createQuery. I got it to work and it did do full joins. It was also slow as hell. One query took 15 seconds to get a list of 21,000 records whereas before things were running well under one second.
Besides, once you get used to HQL it is tough going back to SQL.
Using Java 1.5 I get the following error when I try to do full joins.
Code:
an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: undefined join type 23
at org.hibernate.hql.ast.util.JoinProcessor.toHibernateJoinType(JoinProcessor.java:66)
at org.hibernate.hql.ast.HqlSqlWalker.setImpliedJoinType(HqlSqlWalker.java:370)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3150)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3060)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2938)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:218)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:105)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:134)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:113)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1600)
OK, so I have been looking for creative workarounds. SInce I am able to do LEFT and RIGHT joins, or at least I can do them without getting an error, I tried joining an additional table at the beginning or end of the join chain and then use LEFT or RIGHT joins where I really wanted FULL joins. This resulted in INNER joins.
Perhaps I should word my question this way: under what conditions does Hibernate decide to give you and inner join despite your asking for some kind of outer join?
Certainly, the above sort of logic would make sense. Could it be that it is backfiring on me? I will admit that there are some times that due to a WHERE clause I really should be using an inner join and may have coded up an outer join out of expediency, but I know for a fact that full outer joins with no where clause present are not working for us.
I guess my next step is to do more stepping into the Hibernate code to see exactly what is going on. I sure would appreciate some kind of response to either tell me to forget about full outer joins, that they categorically do not work OR that they do routinely work for others and any hints about how they are getting them to work.