Lazy « Query « JPA Q&A





1. How to build HQL query, thats joins subtables marked LAZY, automatically?    stackoverflow.com

I have some entity:

  public class Album extends GenericAuditedEntity {

    @OneToMany(fetch = FetchType.LAZY)
    private Set<Item> itemSet = new HashSet<Item>();
  }
And when i run ...

2. Hibernate: Projection of a many-to-one in a Criteria    stackoverflow.com

I am playing around with the hibernate Criteria API for the first time recently. I was trying to do the equivalent of this HQL "select t.userTbl from Task t" userTbl property is a many-to-one ...

3. Updating JPA-Hibernate entity without selecting it from database    stackoverflow.com

I have a hibernate entity called Execution. It is created in the beginning of my process and updated at end, indicating how it has finished. I would like to update a single ...

4. Avoiding secondary selects or joins with Hibernate Criteria or HQL query    stackoverflow.com

I am having trouble optimizing Hibernate queries to avoid performing joins or secondary selects. When a Hibernate query is performed (criteria or hql), such as the following:

return getSession().createQuery(("from GiftCard as card where ...

5. Envers query returns a lazy result instead of an eager one    stackoverflow.com

I have an Envers query that returns a lazy result although the field is defined in hibernate-mapping with lazy="false". I have looked it up at the Hibernate-Envers forums and didn't find any ...

6. Hibernate lazy property whit projections    stackoverflow.com

If you have your bean MyClass whit alot of properties. If you want to lazy get one property with @Basic( fetch=lazy) you need to instrument your class right? but what if you do ...

7. lazy many-to-one doesn't work for Query    forum.hibernate.org

Newbie Joined: Tue Jul 15, 2008 12:34 pm Posts: 5 i got this kinf of class, Code: ...

8. Lazy property with projections    forum.hibernate.org

Hello everybody. If you have your bean MyClass whit alot of properties. If you want to lazy get one property with @Basic( fetch=lazy ) you need to instrument your class right?. but what if you do a projection over your bean and then do a ResultTrasnformer(TransFormers.aliasToBean(MyClass.class)) something like this: Usuario usuario = (Usuario) session /*.get(Usuario.class, 1); this gets the whole object ...

9. Retrieving objects from a query lazily    forum.hibernate.org

I'm trying to find an O/R framework that can perform paging. The first type would be a query that would retrieve rows from a database using an Iterator. When next() is called rows are feteched as needed. This is useful for a client app that retrieves more rows from a database when the user moves the them in a list within ...





10. Multiple Queries on many-to-one (not a "lazy" prob    forum.hibernate.org

Hibernate 2.1.6 MySQL 4.0.20 Would someone please explain to my why when doing a query on an object with only many-to-one relationships, why multiple queries are required to retrieve the objects? For instance if I had the following mapping file (below) and I issues a simple query like "from ForumTopic" hibernate does one query to get all the ForumTopics, but then ...

11. Lazy queries, as opposed to lazy collections    forum.hibernate.org

Gentlemen, I am fairly new to Hibernate and have a question about lazy fetching. The lazy fetching of collections is very nice, but is it possible to fetch lazily on the topmost query level? In other words, if I have a Person class that contains 100,000 objects, and I do a "from Person" query, is there a way to tell hibernate ...

12. First query fetchs lazy associations    forum.hibernate.org

Author Message beowulf Post subject: First query fetchs lazy associations Posted: Tue Jan 18, 2005 2:29 pm Newbie Joined: Fri Oct 01, 2004 7:01 am Posts: 3 Grettings I have a simple query (below) that fetches objects (Produto) with one many-to-many association witch is declared as lazy. When I execute the query the lazy collection is fetched (as can ...

13. Relationship is lazy, but an unnecessary SELECT stmt is exec    forum.hibernate.org

Newbie Joined: Wed Jul 27, 2005 3:44 pm Posts: 12 Location: Los Angeles, CA Hello. VendorKeyword can have 0 or 1 custom Creative, hense one-to-one relationship in .xml.hbm. The Java code will check if a VendorKeyword object with given primary key exists (session.get(...)) and creates new instance if existing object is not found. Then, if necessary, a new instance of Creative ...

14. question about lazy and query ....    forum.hibernate.org

15. Lazy select    forum.hibernate.org

16. Resolution of lazy property fails with NPE for sql-query    forum.hibernate.org

With Hibernate 3.1, I defined a property as lazily resolved and performed the requisite instrumentation via the Ant InstrumentTask task. While the lazy resolution behaved correctly for objects that I resolved via Session.get(), it did not behave correctly for objects I resolved via Query.list(); cglib failed with a NullPointerException when the proxy attempted to resolve the lazily-loaded property. On a related ...





17. Initializing lazy collections in an HQL Query    forum.hibernate.org

18. lazy initialiaztion error using query cache    forum.hibernate.org

I have a unique problem. I am using ehcache for 2nd level caching. The following query joins the assosciation with the parent object.If i am not using queryCache i am able to access the assosociation withou any problem. If I use with query Cache enabled I get a lazy initization exception error when accessing the assosciation. I have defined the echache.xml ...

19. Lazy many-to-one with remote query    forum.hibernate.org

Hello, With my current project I have the following situation to map: We have two databases, one containing requests and (due to a legacy database landscape which I cannot change) another one containing data to those requests. Now to provide the data to the application in a transparent way I'm trying to map the data as a virtual view using a ...

22. query cache always returns result with lazy collections    forum.hibernate.org

I am trying to give second level cache and query cache a try for my project. here is the versio information: 1. Hibernate: 3.3.2 2. EHCache: 1.6.0 However, although query cache seems to be working. It always return result with lazy collections, even if my original query eagerly fetch the collections. For example: In Service class // open session criteria = ...