[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5882) JPA lazy Load problem on many-to-one property getter

Leo Deng (JIRA) noreply at atlassian.com
Sun Jan 30 04:58:05 EST 2011


JPA lazy Load problem on many-to-one property getter
----------------------------------------------------

                 Key: HHH-5882
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5882
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.6.0
         Environment: Windows 7, JDK 1.6 ,MySQL 5.5
            Reporter: Leo Deng
            Priority: Critical
         Attachments: TestJPA.zip

Hibernate could not work properly when I use lazy load in many-to-one situation.you can run the test case in attachment.

I try to get primary-key property of parent object which get from child object property.Hibernate query the parent object from database by foreign key successfully. But when I try to use org.hibernate.property.Getter Interface to read some property, hibernate return null to me. 

My code in attachment can be described as follow:
<1>Test function "TestEagerLoadManyToOne" using Eager load can pass the test. Code logic are:
1)Load Child object from database 
2)Get "parentObj" property and test whether "parent_id" field in parent is NULL;
2)Use org.hibernate.property.Getter to get "parent_id" field and test the result.

<2>Test function "TestLazyLoadManyToOne" do exactly same thing just like "TestEagerLoadManyToOne", but the "Child" class change "parentObj" property to lazy load mode. this test function could not pass.

Please fix this issue. It's crucial to my project.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list