query « Load « JPA Q&A





1. Pre loading objects in an HQL query    stackoverflow.com

I'm using the following HQL query to try and load a set of objects when I select a Student object based on the advice found at the following link. http://www.javalobby.org/articles/hibernate-query-101/

from ...

2. On-demand eager loading    stackoverflow.com

I make a query:

String query = "SELECT DISTINCT a FROM A a FETCH ALL PROPERTIES " +
     "JOIN a.Bs AS b " +
     ...

3. LazyException while loading a collection through named query    forum.hibernate.org

Newbie Joined: Tue Dec 07, 2010 6:11 pm Posts: 1 Hi, I am using Hibernate 3.2 in my project. My database is Oracle 10g. I am trying to initialize a set using a named query. I am getting a LazyInitialization exception. Please let me know what am I missing. Any help would be highly appreciated. Thanks Anuradha Log messages including stack ...

4. sql-query problems using individual properties to load Set    forum.hibernate.org

Author Message iksrazal Post subject: sql-query problems using individual properties to load Set Posted: Sat Apr 16, 2011 1:39 pm Beginner Joined: Fri Apr 15, 2005 3:30 pm Posts: 46 Location: Fortaleza, Brazil Hi all, I am running hibernate 3.5.4 with SQL Server 2008, and I cannot get past this error: Code: 2011-04-16 11:01:20,314 [org.hibernate.util.JDBCExceptionReporter] - could not execute ...

5. use of load query in hibernate    forum.hibernate.org

6. Loading objects with Uninitialized Collections through Query    forum.hibernate.org

To be more specific, When I load my Parent object using session.load() the object is loaded but its collection of Child objects are not initialized since they are to be lazily loaded later. I want to achieve this same kind of loading by using a hibernate query The problem that Im facing is that when I try to load Parent using ...

7. sql-query and load-collection -- how?    forum.hibernate.org

I have a data model which has three tables: STORE, REGISTER, and PURCHASE. A store has many registers and a register has many purchases. In my object model I need to create a collection of the 100 most recent purchases on the Store class. I figured using a set and the loader/sql-query elements would do the trick, but there's not a ...

8. Loading only baseclass in query    forum.hibernate.org

Hi, How can I retrieve just the baseclass of an object in a query? I'm using table-per-subclass. When I run a query, I get the actual types of the objects: SubclassA, SubclassB, etc. I don't want to execute a whole series of joins, as I'm only interested in the fields of the Baseclass, so I was wondering if there is a ...

9. n+1 on a Query, but want eager loading    forum.hibernate.org

I have a very simple pice of code: Query query = session.createQuery("from Site as site"); query.setFetchSize( 10); List list = query.list(); v.addAll(list); My problem is that these lines lead in a n+1 queries to the database. The mapping for the Site object is: ... How do I define eager loading directly for the entity that is ...





10. Differences between objs loaded via query vs. via get/load    forum.hibernate.org

I am migrating a data access layer to hibernate, a few classes at a time. I have had Partition, Meter and StoreMeter working fine for a while, and am now adding MeterChannel. Meter joins one-to-one with StoreMeter and many-to-one with Partition. MeterChannel joins many-to-one with Meter. So when I load a MeterChannel, I am non-lazily, and with fetch="join", loading Meter and ...

11. query/load by example    forum.hibernate.org

I'm doing a data import system on top of hibernate... The import data doesn't know about the primary key value within hibernate, so I need some way to be able to find/load an instance based on its other unique constraint(s). Can hibernate do this? Or will I have to manually pick out the unique attributes and add them to a Criteria? ...

12. Code Help: Complex Query -> Loading Object with Associati    forum.hibernate.org

I need help w/ something that might be basic, but I'm having difficulty finding a concise answer to. I am attempting to perform a "complex" query and return back a proper object graph of my results. My scenario is similar to a Salesperson tracking system, where Salesperson has a residential State/Region, and they have many "coverage" State/Regions. Tables & Relationships: Person-1--------1->StateRegion ...

13. Using HQL for Class loader query    forum.hibernate.org

I'm having a problem using HQL in a loader query for a class. If I use a SQL query instead it works fine and the class is loaded. I can see the SQL generated from the HQL is correct and using Profiler on the database I can see that the single parameter to the SQL is correct. However, the row that ...

14. is it possible to load all objects in 1 query?    forum.hibernate.org

I understand the lazy-attribute, but does hibernate fullfill the following desire on a kind of a fast bulkLoad? The datastructure is the same as you know it from folders (and files) for example in the windows-explorer. So a folder can contain other folders (sub-folders). - In our example folder A contains the 2 folders B and C. - And folder B ...

15. Do this query will do lazy loading for table1    forum.hibernate.org

16. Lazy loading using named query    forum.hibernate.org

Hibernate version: 3.2.6 Hello all, I have a mapping where an Order has one Customer and each Customer may have multiple CustomerAddresses. I want to enable lazy loading of Customer and CustomerAddress but want to apply a named query that filters the CustomerAddress of a particular type. I am not able to figure out how to tie up a named query ...





17. Collection loaded with sql-query throws NullPointerException    forum.hibernate.org

Author Message jeff.warren Post subject: Collection loaded with sql-query throws NullPointerException Posted: Thu May 01, 2008 11:38 am Newbie Joined: Thu May 01, 2008 7:35 am Posts: 7 Location: Minneapolis, MN Hello. I'm a long-time Hibernate user, lurker on the forums, and first-time poster. I have been chasing this problem for a week, on Windows, LINUX, and Solaris, using ...

18. Loading Collection of Strings using SQL query    forum.hibernate.org

I actually need to select the roles based on values in other tables, so the sql looks more like this: Code: select distinct user_role.role_name_fk from user_role, customer, supplier where ( ( user_role.user_name_fk = ? AND user_role.role_name_fk = 'Customer' AND customer.user_name_fk = ? AND customer.customer_active = 1 ) OR ...