generate « Join « JPA Q&A

1. HQL Generating incorrect SQL for outer left joins

Hi, We have recently upgraded our application from 3.0.5 to 3.5.5-FINAL and have found an error with the SQL being generated. We have a simple class with two subclasses. On the supertype is a 0..1 association to an entity holding error status (Most of the time this will be empty) and used to filter out those entities who have an error ...

2. Generated join using multiple many-to-ones incorrect?

Hibernate version:2.1.6 Mapping documents: Code between sessionFactory.openSession() and session.close(): Session session = sessionFactory.openSession(); Query query = session.createQuery("from Company c where like '%1%'"); System.out.println("num companies: " + query.list().size()); query = ...

3. Too many JOINs in generated SQL

Hi all, I'll start with standard stuff: Hibernate version: 2.1.7c Name and version of the database you are using: MySQL 4.0 Mapping documents (only relevant parts shown for brevity): Code:

4. redundand joins in generated sql

Hi I have written Hibernate Criteria that searches in table Transactions. Why Hibernate has genereted SQL query with all those joins that are completely redundand ? Hibernate version: 2.1 Code between sessionFactory.openSession() and session.close(): Code: Criteria criteria = session.createCriteria(Transaction.class) .add(Expression.le("statusRefreshTime", systemDate)) ...

5. The sql still get generated for one-to-many with outer-join?

Hibernate version: Hibernate 2.1.1 Database: MS SQL 2000 Hi all I have posted the problem in this forum before but I am still not getting what i want. I have given more information this time and hope someone could help. Thank you! ... 87#2271387 I have set show_sql="true" and show that the sql for one-to-many still get generated. String hql ...

6. There are generated left outer joins instead of inner joins

Need help with Hibernate? Read this first: ... AskForHelp Hibernate version: 3.0.5 I have problem that left outer joins are generated instead of inner joins. I have following 4 objects: Party - AccountPartyRelation - Account - AccountYTurnOver I'm accesing AccountPartyRelations from Party and I want that all accounts are loaded at the same time. I'am not using Query but traversing ...

7. Left outer join/many-to-one -> unexpected generated sql

Newbie Joined: Tue Jul 12, 2005 5:41 am Posts: 7 I have three cascade classes (A->B->C) with a many to one relationship. I query the first two by a left outer join but select a field of the third one as well. I expected the third to be left-outer-joint as well but the outcome is different from what I expected and, ...

8. Problem generating an inner join

Hi All Using Hibernate for the first time and I'm having some teething problems... Mapping document 1 =============

9. Multiple joins generated..

I tried that route first, but with the hack job that is needed to get server side DISTINCTs to work, I opted out of it. With out being able to use distinct it pretty much goes down the drain when trying to get the correct results. And even the hack I found in the forums here didn't work correctly.

10. Incorrect SQL join generated in some cases

Hibernate version: 3.0.2 Mapping documents: There is a bidirectional one-many mapping from Chromosome to Gene. Chromosome.hbm.xml: Gene.hbm.xml:

11. [Solved] Too many implicit joins generated

Newbie Joined: Wed Aug 01, 2007 4:18 am Posts: 4 Hi ! I'm quite new to hibernate and my problem is that when I use a request with not-simple hql criteria, using implicit joins, hibernate generates a sql request with too many joins, which are useless and redundants. I have 3 tables which mappings, generated by hibernate tools in Eclipse, are ...

12. Nested Join Criteria generates non-working SQL

13. generate outer join automatically

14. detachedcriteria.createAlias not generating join

Newbie Joined: Thu Jul 16, 2009 4:18 am Posts: 3 I'm using detachedCriteria to create a correlated subquery. This all works fine until I try to add an alias to the detachedcriteria in which case hibernate adds the restriction, but does not add a join for the new aliased table. Unfortunately hibernate also don't throw any kind of exception to let ...

15. Inner Join on Auto-Generated Table