Question « Load « JPA Q&A





1. Newbie Hibernate Question: HQL to Load single child object given the parent object and a secondary key on child object    stackoverflow.com

Sorry if this is very basic as a question....but I can't my head around the HQL syntax from the examples I have seen.... I have parent class ('File') which has a one-to-many ...

3. Questions about LAZY and EAGER loading (JPA 1.0)    coderanch.com

Hi, I have a few questions regarding LAZY and EAGER loading on JPAs... if you can answer any of them I'd be grateful to hear your response. 1. Firstly, I can't work out if lazy loading is even working. Even if I specify FetchType LAZY on mapped entities, and use my debugger to examine the entity that came back, I can ...

4. Question regarding lazy loading    forum.hibernate.org

I have an enity 'A' which as a collection of enity 'B', the collection is mapped to be lazily loaded which works fine as expected. Entity 'B' has an one to one relationship with entity 'C' which I have mapped to be lazily loaded by Proxy.But I see that a sql is immediatley executed to fetch enity 'C' whenever the parent ...

5. Large object loading question    forum.hibernate.org

6. updating a previously loaded object question    forum.hibernate.org

Hi, If I try to update an object loaded in the same session, by calling one of the setter and then flush(), if the new value of the property is the same like the old one, no update is issued to the DB. Session session = ... Person person = session.find(...) person.setName("sameName") // same value as in the person object session.flush(); ...

7. updating a previously loaded object question    forum.hibernate.org

8. Simple question about Session.load/get    forum.hibernate.org

Hello everyone, If B extends A and C extends A, am I right that Session.get(B.class, id) would return null if the id entity is actually an instance of class C? Am I correct that in the same constellation a HibernateException will be thrown for Session.load(B.class, id)? I am talking about Hibernate 2.1. Regards, Andreas

9. BASIC: Lazy Loading Question    forum.hibernate.org

Hi! I hope this question deserve your attention and answer. I got the following secuence: - Open my session - Get a list of objects using lazy loading - Close the Session The user pick one of those objects. I try to load the pending objects (those ones related to this by many-to-one mapping) using the follwing code: Code: public void ...





10. Interceptor and lazy loading question    forum.hibernate.org

I have a Hibernate2 application that uses the Interceptor interface to track changes to data in an audit trail. (The audit trail records both the before and after value of an object for each audit event.) The javadoc for the Interceptor interface makes it clear that "the session may not be invoked from a callback (nor may a callback cause a ...

11. one-to-one with Lazy loading quest question    forum.hibernate.org

I have some one-to-one mappings from class A to B, C and D.Using primary key association. When I queried from A which is used for getting B, the code as below: A a = (A)s.uniqueResult(); B b = a.getB(); hibernate always make a sql with many outer join on B,C and D. Can I just have an outer join with B? ...

12. one-to-one with Lazy loading question    forum.hibernate.org

I have some one-to-one mappings from class A to B, C and D.Using primary key association. When I queried from A which is used for getting B, the code as below: A a = (A)s.uniqueResult(); B b = a.getB(); hibernate always make a sql with many outer join on B,C and D. Can I just have an outer join with B? ...

13. Question about lazy loading    forum.hibernate.org

Hi, Lets say I load an Object which is a root of a large relationships tree, some of it is retrieved in lazy mode. Would the relationship expand also after I close the session? I am asking this because I am working on a Web-App, in which there is a big amount data with complex relationships. This data does not change, ...

14. Interceptor / lazy loading stupid question    forum.hibernate.org

I implemented the Interceptor interface so that when my Picture class object is deleted, it also deletes the actual file in the filesystem referenced by the class. I also have a PictureGroup class that contains a lazy-loaded list of Pictures. Do the Interceptor methods get called on every item in lazy-loaded collections, even if the collection hasn't been loaded yet? In ...

15. A question about the method "load"    forum.hibernate.org

I've made a application just like the example in the "2.3.3. Working the association" of "hibernate_reference.pdf" [code]org.hibernate.Session session1 = HibernateUtil.currentSession(); org.hibernate.Transaction tx = session1.beginTransaction(); TabHibtest aTest = (TabHibtest)session1.load(TabHibtest.class,new Integer(1)); TabHibchild aChild = (TabHibchild)session1.load(TabHibchild.class,new Integer(1)); aTest.getChilds().add(aChild); tx.commit(); HibernateUtil.closeSession();[/code] "TabHibtest " and "TabHibchild" just like "Person" and "Event" in the example. And my "id"'s type is Integer. I write them in a jsp. ...

16. Question regarding Session.load()    forum.hibernate.org

Employee table has a composite primary key - empno, companyno. How do I load an instance of Employee object using Session.load() method? load() method takes "id" as the 2nd parameter. In this case, i'd need to pass both empno, companyno. how do i do that? I apologize for asking very basic qns... but i couldnt any suitable API to achieve this... ...





17. Lazy Loading Question    forum.hibernate.org

Newbie Joined: Thu Feb 08, 2007 1:28 pm Posts: 9 Let me start by saying I've read through all the documentation I could find, and searched google extensively, and read through the lazy loading section in Java Persistence with Hibernate. I feel as though a lot of performance can be gained from lazy loading, which we don't use at all right ...

18. Yet another Lazy Loading question    forum.hibernate.org

I've read a lot of articles about lazy loading, but none seem to mention my specific question. Let's say my class looks like this: Code: public class Node { private List children; private Node parent; private String name; public List getChildren() { return children; } public Node getParent() { return parent; } public void setChildren(List children) { ...

19. Question about LAZY Loading    forum.hibernate.org

This is one of the most common problems people have when they start using Lazy loading of their components. Basically, your program is looking to access a lazily loaded object that has an association with an object that has already been loaded. However, the session that loaded the primary object has been closed, and the transaction has ended. So, now you ...

20. Question about lazy loading    forum.hibernate.org

Hello, I have arrived at 13.1.2 of 'the book' which tells me lazy loading is Hibernate's default fetching strategy. However, when I load() or get() a new Section into the session like this Section section = (Section) hsession.get(Section.class, new Long(1)); The generated SELECT statement joins multiple tables. It uses SECTION (good), but also SECTIONLAYOUT (referenced by Section) and even SECTIONTEMPLATE (referenced ...