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

Steve Ebersole (JIRA) noreply at atlassian.com
Wed Dec 28 10:38:19 EST 2011


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5882?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Ebersole closed HHH-5882.
-------------------------------

       Resolution: Rejected
    Fix Version/s:     (was: 4.0.1)

You are not using these correctly.  Like I said, these are not APIs that are supported for random use.  We support them only in our internal usage.

I will tell you that the issue stems from the type of Getter you are attempting to use, which is set up by the fact that you are annotating fields.  This sets up a {{org.hibernate.property.DirectPropertyAccessor}} instead of a {{org.hibernate.property.BasicPropertyAccessor}}.  {{org.hibernate.property.DirectPropertyAccessor}} directly access fields, here circumventing (delegation to the proxy target and value initialization).

> 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
>            Assignee: Steve Ebersole
>         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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list