You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Jeremy Bauer (Created) (JIRA)" <ji...@apache.org> on 2012/02/24 14:24:48 UTC

[jira] [Created] (OPENJPA-2141) Lazy fetch of embedded attributes does not work properly

Lazy fetch of embedded attributes does not work properly
--------------------------------------------------------

                 Key: OPENJPA-2141
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2141
             Project: OpenJPA
          Issue Type: Bug
          Components: jdbc
    Affects Versions: 2.3.0, 2.2.1
            Reporter: Jeremy Bauer
            Assignee: Jeremy Bauer


OpenJPA's @Persistent annotation and configuration via OpenJPA's xml extensions provide a mechanism to mark embedded fields lazy.  When trying to use this facility I found a couple bugs.
Bug 1: The xml extension does not process the fetch attribute, so the field is never marked lazy.
Bug 2: If marked lazy via the annotation or xml (with a fix) the lazy field does not get loaded along with the entity (as expected), but then will not load when accessed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2141) Lazy fetch of embedded attributes does not work properly

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13262737#comment-13262737 ] 

Mark Struberg commented on OPENJPA-2141:
----------------------------------------

txs, I'll create a new issue.
                
> Lazy fetch of embedded attributes does not work properly
> --------------------------------------------------------
>
>                 Key: OPENJPA-2141
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2141
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.3.0, 2.2.1
>            Reporter: Jeremy Bauer
>            Assignee: Jeremy Bauer
>
> OpenJPA's @Persistent annotation and configuration via OpenJPA's xml extensions provide a mechanism to mark embedded fields lazy.  When trying to use this facility I found a couple bugs.
> Bug 1: The xml extension does not process the fetch attribute, so the field is never marked lazy.
> Bug 2: If marked lazy via the annotation or xml (with a fix) the lazy field does not get loaded along with the entity (as expected), but then will not load when accessed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2141) Lazy fetch of embedded attributes does not work properly

Posted by "Jason Pyeron (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13215606#comment-13215606 ] 

Jason Pyeron commented on OPENJPA-2141:
---------------------------------------

Do you think you could attach an example that I can use for testing?
Do you have the patch for the xml "fix"?

Thanks
                
> Lazy fetch of embedded attributes does not work properly
> --------------------------------------------------------
>
>                 Key: OPENJPA-2141
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2141
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.3.0, 2.2.1
>            Reporter: Jeremy Bauer
>            Assignee: Jeremy Bauer
>
> OpenJPA's @Persistent annotation and configuration via OpenJPA's xml extensions provide a mechanism to mark embedded fields lazy.  When trying to use this facility I found a couple bugs.
> Bug 1: The xml extension does not process the fetch attribute, so the field is never marked lazy.
> Bug 2: If marked lazy via the annotation or xml (with a fix) the lazy field does not get loaded along with the entity (as expected), but then will not load when accessed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2141) Lazy fetch of embedded attributes does not work properly

Posted by "Jeremy Bauer (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13215651#comment-13215651 ] 

Jeremy Bauer commented on OPENJPA-2141:
---------------------------------------

Note: the fix I committed does not yet handle the "embedded" attribute via XML.  The field still needs to be annotated or tagged embeddable in xml.  There's a bit more code and testing to handle this attribute.  I plan to work on that item in the future.  
                
> Lazy fetch of embedded attributes does not work properly
> --------------------------------------------------------
>
>                 Key: OPENJPA-2141
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2141
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.3.0, 2.2.1
>            Reporter: Jeremy Bauer
>            Assignee: Jeremy Bauer
>
> OpenJPA's @Persistent annotation and configuration via OpenJPA's xml extensions provide a mechanism to mark embedded fields lazy.  When trying to use this facility I found a couple bugs.
> Bug 1: The xml extension does not process the fetch attribute, so the field is never marked lazy.
> Bug 2: If marked lazy via the annotation or xml (with a fix) the lazy field does not get loaded along with the entity (as expected), but then will not load when accessed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2141) Lazy fetch of embedded attributes does not work properly

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13262746#comment-13262746 ] 

Mark Struberg commented on OPENJPA-2141:
----------------------------------------

I've now created OPENJPA-2179 for this.
                
> Lazy fetch of embedded attributes does not work properly
> --------------------------------------------------------
>
>                 Key: OPENJPA-2141
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2141
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.3.0, 2.2.1
>            Reporter: Jeremy Bauer
>            Assignee: Jeremy Bauer
>
> OpenJPA's @Persistent annotation and configuration via OpenJPA's xml extensions provide a mechanism to mark embedded fields lazy.  When trying to use this facility I found a couple bugs.
> Bug 1: The xml extension does not process the fetch attribute, so the field is never marked lazy.
> Bug 2: If marked lazy via the annotation or xml (with a fix) the lazy field does not get loaded along with the entity (as expected), but then will not load when accessed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2141) Lazy fetch of embedded attributes does not work properly

Posted by "Jeremy Bauer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13262728#comment-13262728 ] 

Jeremy Bauer commented on OPENJPA-2141:
---------------------------------------

Mark - given that none of your fields are marked lazy, I'd guess what you've described is a separate issue.  It looks like our logic to determine whether a lob can be fetched inline may need to be reviewed for certain queries.  Each DB vendor also has various levels of support for inlining so what you see could be DB specific as well.  Unless the fields in the embeddable are tagged as lazy, I'm not sure why we'd need to fetch them separately.  That sounds like a bug.

Any chance you can provide a testcase?  I could at least verify what I've added for this JIRA hasn't broken anything.
                
> Lazy fetch of embedded attributes does not work properly
> --------------------------------------------------------
>
>                 Key: OPENJPA-2141
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2141
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.3.0, 2.2.1
>            Reporter: Jeremy Bauer
>            Assignee: Jeremy Bauer
>
> OpenJPA's @Persistent annotation and configuration via OpenJPA's xml extensions provide a mechanism to mark embedded fields lazy.  When trying to use this facility I found a couple bugs.
> Bug 1: The xml extension does not process the fetch attribute, so the field is never marked lazy.
> Bug 2: If marked lazy via the annotation or xml (with a fix) the lazy field does not get loaded along with the entity (as expected), but then will not load when accessed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2141) Lazy fetch of embedded attributes does not work properly

Posted by "Jeremy Bauer (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13215608#comment-13215608 ] 

Jeremy Bauer commented on OPENJPA-2141:
---------------------------------------

Fix and test committed to trunk (2.3.0) under rev 1293250.
                
> Lazy fetch of embedded attributes does not work properly
> --------------------------------------------------------
>
>                 Key: OPENJPA-2141
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2141
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.3.0, 2.2.1
>            Reporter: Jeremy Bauer
>            Assignee: Jeremy Bauer
>
> OpenJPA's @Persistent annotation and configuration via OpenJPA's xml extensions provide a mechanism to mark embedded fields lazy.  When trying to use this facility I found a couple bugs.
> Bug 1: The xml extension does not process the fetch attribute, so the field is never marked lazy.
> Bug 2: If marked lazy via the annotation or xml (with a fix) the lazy field does not get loaded along with the entity (as expected), but then will not load when accessed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2141) Lazy fetch of embedded attributes does not work properly

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13262681#comment-13262681 ] 

Mark Struberg commented on OPENJPA-2141:
----------------------------------------

Actually I found a bug which could be related to this.

I have an Entity (Course) with a simple @Embedded field and a @Lob. I do not use any LAZY attribution on them! 


If I do a normal em.find, the entity will be loaded as a whole (all the fields, including the embedded and the lob will be fetched immediately). 
Sidenote: the Lecturer referred in the select is defined as
    @OneToMany(mappedBy = "course",
            cascade = {CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.MERGE},
            orphanRemoval = true, fetch = FetchType.EAGER)
    @OrderColumn(name = "POSITION")
    private List<Lecturer> lecturers;

The following selects DO work  
* "select c from Course c join c.lecturers l "
* "select distinct c from Course c"

The following selects create tons of subqueries! 1 separate sub-query for each @Embedded field, and also for each @Lob

* "select distinct c from Course c join  c.lecturers l "
* "select distinct c from Lecturer l join l.course c"
* "select c from Lecturer l join l.course c"

Should I create a separate issue or do you think it's related?
                
> Lazy fetch of embedded attributes does not work properly
> --------------------------------------------------------
>
>                 Key: OPENJPA-2141
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2141
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.3.0, 2.2.1
>            Reporter: Jeremy Bauer
>            Assignee: Jeremy Bauer
>
> OpenJPA's @Persistent annotation and configuration via OpenJPA's xml extensions provide a mechanism to mark embedded fields lazy.  When trying to use this facility I found a couple bugs.
> Bug 1: The xml extension does not process the fetch attribute, so the field is never marked lazy.
> Bug 2: If marked lazy via the annotation or xml (with a fix) the lazy field does not get loaded along with the entity (as expected), but then will not load when accessed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira