Multiple Table « Join « JPA Q&A





1. Hibernate newbie stuck with multiple table joins    forum.hibernate.org

I have the following table structure : Table A A.id Table B B.id A.id Table C C.id B.id Table D D.id C.id I need to get a list of all A's and each A should have a collection of D's. I can easily write the sql for this but have no clue on how to implement this with hibernate. Kindly suggest ...

2. Join across multiple unrelated tables with Criteria API?    forum.hibernate.org

I'm doing a persistence framework evaluation and am currently working with Hibernate 2.1.2. One of the aspects I'm looking at is the degree to which we can eliminate embedded SQL from our application code, so I'd like to make use of the Criteria API as much as possible. The following code works. Code: Query query = session.createSQLQuery( ...

3. Multiple Table Criteria Join Help    forum.hibernate.org

Hi guys. I am a bit stumped on how to do joins using Criteria queries. I am sure its pretty simple but the documentation doesn't seem very clear on this topic. Say I have the following sql: Code: SELECT DISTINCT * FROM permission p JOIN role_permission rp ON p.permission_id = rp.permission_id JOIN user_role ur ON rp.role_id = ur.role_id WHERE ur.user_id = ...

4. case statement with multiple joins to the same table    forum.hibernate.org

The situation I'm seeing is that when a class has a many-to-one mapping to another table multiple times, that the HQL case statement can generate improper SQL. More specifically to my context, there is an Entity class that has FK's to a Contact table for each type of contact. The Contact class has a nullable FK to an SMSProvider class, which ...