return « Join « JPA Q&A





1. NHibernate HQL Join Not Returning All Required Rows    stackoverflow.com

I am modifying an existing HQL query which returns individual columns rather than an object graph but now I am not getting all rows that I need. Here a few facts about ...

2. HQL join returns too many rows    stackoverflow.com

Dear Stackoverflow gurus! I have a question regarding the join syntax of HQL. Whatever I do, I seem to get to many rows returned. I have the following relation: Building -> floors -> ...

3. Returning multiple object types using hibernate using an inner join    stackoverflow.com

I seem to be having some difficulty with a query in hibernate. I am performing an inner join on two tables.

SELECT * FROM product p INNER JOIN warehouse w ON p.wid ...

4. JPQL Left Join - Filter right rows while returning all left rows    stackoverflow.com

I have a two entities that are related like so.

public class User {
    @Column(name = "ID")
    private Integer id;
    @OneToMany(mappedBy = "customerUserId")
 ...

5. HQL right outer join returning partial result with InheritanceType.SINGLE_TABLE    stackoverflow.com

I have the following HQL query:

    entityManager.createQuery("Select customer FROM VisitEntry 
visitEntry RIGHT OUTER JOIN visitEntry.customer customer
 GROUP BY customer ORDER BY max(visitEntry.date) desc").getResultList();
These are my objects:
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
public class LogEntry ...

6. HQL join returns no results.    coderanch.com

Hello all, I am new to hibernate and am having trouble with making a join query in HQL. This is between 2 classes with a one-to-many/many-to-one relationship. I am trying to join in the second class based on matches between 2 columns, where classA.jono = classB.jono. The relationship is one classA to many classB. I am using a join table. I ...

7. Inner join returning same record multiple times    forum.hibernate.org

I have two tables A and B and both of them donot have any referential integrity. However one field of both the tables is common say 'commonId'. I need to fetch values from both the tables and return and im using the commonId to establish a join. The data returned is just one column repeated n number of times where n=actual ...

8. Multiple Join Returns Set of Objects; SQL returns one    forum.hibernate.org

Good morning! I have been working on this issue for the last few days, and I have searched and am looking for advice. When I run the query in SqlYog, I return one row. When I place the code into Hibernate using SQLQuery, I am returning a set of Elections when I should be returning only one. Here is the SQL ...

9. HQL join returns Objects    forum.hibernate.org

LOL. I keep answering my own questions here. But hey, at least it may be useful for other people. When joining without using "fetch", Hibernate does not return the objects you want directly, it returns an array of objects. Code: String query = "from Text text " + "join text.role " + "where text.language = :language"; ...





10. Native SQL: Left outer Join returns wrong data    forum.hibernate.org

public void performDiscovery(Metadata metadata, List types, List aliases) throws SQLException { if ( alias == null ) { alias = metadata.getColumnName( position ); }

11. Return type of HQL with outer joins    forum.hibernate.org

12. Returning only first object/table data from theta join    forum.hibernate.org

I'm modelling atree structure in hibernate based on nested set theory (see here http://www.intelligententerprise.com/00 ... o1_1.jhtml ). In the query below, I'm not interested in bringing back the parent object at all, just the children, but as it stands the query will bring back a collection of two element arrays, containing the child as the first array element, and the parent ...

15. Using return-join throws IllegalArgumentException    forum.hibernate.org

Hi, We have a Parent(which has a primitive id) and a child which has composite id. We are trying to use the sql-query and the result-join to get going but are running into IllegalArgumentException. Here's our mapping: Parent Mapping Code: ...

16. joins without returning data    forum.hibernate.org

Hi, I'm thinking of using nhibernate over crud store procedures, is it possible to get a collection of objects from a join query without returning the data for the tables in the join. e.g. I want orders between dates of abc and def for customers with addresses that have a postcode of xyz or select o.* from orders o inner join ...





17. addJoin & seem broken in native SQL    forum.hibernate.org

Hibernate version: 3.2.4ga (HSQLDialect) I'm using native SQL queries and they are not behaving as I expect them to. In particular addJoin() (in Java) or (in XML named query) don't do what I want them to do and in fact don't act any differently than addEntity. I've been using the Hibernate supplied test case org.hibernate.test.sql.hand.query.NativeSQLQueriesTest.testSQLQueryInterface() as provided in the release ...