<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> 
        <base href="https://hibernate.atlassian.net"> 
        <title>Message Title</title> 
    </head> 
    <body class="jira" style="color: #333333; font-family: Arial, sans-serif; font-size: 14px; line-height: 1.429"> 
        <table id="background-table" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0; background-color: #f5f5f5; border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0" bgcolor="#f5f5f5"> 
            <!-- header here --> 
            <tbody>
                <tr> 
                    <td id="header-pattern-container" style="padding: 0; border-collapse: collapse; padding: 10px 20px"> 
                        <table id="header-pattern" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0"> 
                            <tbody>
                                <tr> 
                                    <td id="header-avatar-image-container" valign="top" style="padding: 0; border-collapse: collapse; vertical-align: top; width: 32px; padding-right: 8px" width="32"> <img id="header-avatar-image" class="image_fix" src="https://avatar-cdn.atlassian.com/ffa3c579430dac6fda86e9b7e55cb142?s=48&amp;d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fffa3c579430dac6fda86e9b7e55cb142%3Fd%3Dmm%26s%3D48%26noRedirect%3Dtrue" height="32" width="32" border="0" style="border-radius: 3px; vertical-align: top"> </td> 
                                    <td id="header-text-container" valign="middle" style="padding: 0; border-collapse: collapse; vertical-align: middle; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px"> <a class="user-hover" rel="dave.radtke" id="email_dave.radtke" href="https://hibernate.atlassian.net/secure/ViewProfile.jspa?name=dave.radtke" style="color:#6c797f;; color: #3b73af; text-decoration: none">Dave Radtke</a> <strong>commented</strong> on <a href="https://hibernate.atlassian.net/browse/HHH-11147" style="color: #3b73af; text-decoration: none"><img src="cid:jira-generated-image-avatar-67455e29-21b7-433a-bd87-e66e920a9d05" height="16" width="16" border="0" align="absmiddle" alt="New Feature"> HHH-11147</a> </td> 
                                </tr> 
                            </tbody>
                        </table> </td> 
                </tr> 
                <tr> 
                    <td id="email-content-container" style="padding: 0; border-collapse: collapse; padding: 0 20px"> 
                        <table id="email-content-table" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0; border-spacing: 0; border-collapse: separate"> 
                            <tbody>
                                <tr> 
                                    <!-- there needs to be content in the cell for it to render in some clients --> 
                                    <td class="email-content-rounded-top mobile-expand" style="padding: 0; border-collapse: collapse; color: #ffffff; padding: 0 15px 0 16px; height: 15px; background-color: #ffffff; border-left: 1px solid #cccccc; border-top: 1px solid #cccccc; border-right: 1px solid #cccccc; border-bottom: 0; border-top-right-radius: 5px; border-top-left-radius: 5px; height: 10px; line-height: 10px; padding: 0 15px 0 16px; mso-line-height-rule: exactly" height="10" bgcolor="#ffffff">&nbsp;</td> 
                                </tr> 
                                <tr> 
                                    <td class="email-content-main mobile-expand " style="padding: 0; border-collapse: collapse; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #ffffff" bgcolor="#ffffff"> 
                                        <table class="page-title-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0"> 
                                            <tbody>
                                                <tr> 
                                                    <td style="vertical-align: top;; padding: 0; border-collapse: collapse; padding-right: 5px; font-size: 20px; line-height: 30px; mso-line-height-rule: exactly" class="page-title-pattern-header-container"> <span class="page-title-pattern-header" style="font-family: Arial, sans-serif; padding: 0; font-size: 20px; line-height: 30px; mso-text-raise: 2px; mso-line-height-rule: exactly; vertical-align: middle"> <a href="https://hibernate.atlassian.net/browse/HHH-11147" style="color: #3b73af; text-decoration: none">Re: Allow enhanced entities to be returned in a completely uninitialized state</a> </span> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                                <tr> 
                                    <td id="text-paragraph-pattern-top" class="email-content-main mobile-expand  comment-top-pattern" style="padding: 0; border-collapse: collapse; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #ffffff; border-bottom: none; padding-bottom: 0" bgcolor="#ffffff"> 
                                        <table class="text-paragraph-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 2px"> 
                                            <tbody>
                                                <tr> 
                                                    <td class="text-paragraph-pattern-container mobile-resize-text " style="padding: 0; border-collapse: collapse; padding: 0 0 10px"> <p style="margin: 10px 0 0; margin-top: 0">I'm attempting to upgrade to 5.2 and have run into this issue. We were using FieldHandler to allow lazy loading a few properties, but this is no longer available.<br> So I enabled byte code enhancement. But this issue has effectively changed every &lt;many-to-one lazy="proxy"&gt; to behave like &lt;lazy="false"&gt;, (which via nested references triggers a massive number of queries).</p> <p style="margin: 10px 0 0">I feel like I'm missing something, because I don't see how this could be the default behavior.<br> Am I doing something wrong?<br> If there anything similar to the old FieldHandler that I can use?<br> Thanks.</p> <p style="margin: 10px 0 0">Simple Beans:</p> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px; border-radius: 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-java" style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal">
@Entity
@Table( name = <span class="code-quote" style="color: #009100">"account_master"</span> )
<span class="code-keyword" style="color: #000091">public</span> <span class="code-keyword" style="color: #000091">class </span>AccountMaster_db {
    
    @Id
    @GeneratedValue( strategy = GenerationType.IDENTITY )
    @Column( name = <span class="code-quote" style="color: #009100">"id_account_master"</span> )
    <span class="code-keyword" style="color: #000091">private</span> <span class="code-object" style="color: #910091">Integer</span>        idAccountMaster;
    
    @ManyToOne( fetch = FetchType.LAZY )
    @LazyToOne( LazyToOneOption.PROXY )
    @JoinColumn( name = <span class="code-quote" style="color: #009100">"id_account_type"</span>, nullable = <span class="code-keyword" style="color: #000091">false</span> )
    <span class="code-keyword" style="color: #000091">private</span> AccountType_db accountType;
    
    @ManyToOne( fetch = FetchType.LAZY )
    @LazyToOne( LazyToOneOption.PROXY )
    @JoinColumn( name = <span class="code-quote" style="color: #009100">"id_tax_code_buy"</span> )
    <span class="code-keyword" style="color: #000091">private</span> TaxCode_db     buyTaxCode;
    
    @ManyToOne( fetch = FetchType.LAZY )
    @LazyToOne( LazyToOneOption.PROXY )
    @JoinColumn( name = <span class="code-quote" style="color: #009100">"id_tax_code_sell"</span> )
    <span class="code-keyword" style="color: #000091">private</span> TaxCode_db     sellTaxCode;
    
    @Column( name = <span class="code-quote" style="color: #009100">"code"</span> )
    <span class="code-keyword" style="color: #000091">private</span> <span class="code-object" style="color: #910091">String</span>         code;
    
    @Column( name = <span class="code-quote" style="color: #009100">"name"</span> )
    <span class="code-keyword" style="color: #000091">private</span> <span class="code-object" style="color: #910091">String</span>         name;
        
@Entity
@Table( name = <span class="code-quote" style="color: #009100">"account_type"</span> )
<span class="code-keyword" style="color: #000091">public</span> <span class="code-keyword" style="color: #000091">class </span>AccountType_db {
    
    @Id
    @GeneratedValue( strategy = GenerationType.IDENTITY )
    @Column( name = <span class="code-quote" style="color: #009100">"id_account_type"</span> )
    <span class="code-keyword" style="color: #000091">private</span> <span class="code-object" style="color: #910091">Integer</span>   idAccountType;
    
    @Column( name = <span class="code-quote" style="color: #009100">"name"</span>, nullable = <span class="code-keyword" style="color: #000091">false</span> )
    <span class="code-keyword" style="color: #000091">private</span> <span class="code-object" style="color: #910091">String</span>    name;
    
    @Column( name = <span class="code-quote" style="color: #009100">"account_class"</span>, nullable = <span class="code-keyword" style="color: #000091">false</span> )
    <span class="code-keyword" style="color: #000091">private</span> <span class="code-object" style="color: #910091">Character</span> accountClass;

</pre> 
                                                            </div>
                                                        </div> <p style="margin: 10px 0 0">Load:</p> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px; border-radius: 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-java" style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal">
AccountMaster_db test = session.find( AccountMaster_db.class, 457 );
</pre> 
                                                            </div>
                                                        </div> <p style="margin: 10px 0 0">Executed SQL:</p> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px; border-radius: 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-java" style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal">
    select
        accountmas0_.id_account_master as id_accou1_0_0_,
        accountmas0_.id_account_type as id_accou7_0_0_,
        accountmas0_.allow_purchases as allow_pu2_0_0_,
        accountmas0_.allow_sales as allow_sa3_0_0_,
        accountmas0_.id_tax_code_buy as id_tax_c8_0_0_,
        accountmas0_.code as code4_0_0_,
        accountmas0_.name as name6_0_0_,
        accountmas0_.id_tax_code_sell as id_tax_c9_0_0_ 
    from
        account_master accountmas0_ 
    where
        accountmas0_.id_account_master=?
                
    select
        accounttyp0_.id_account_type as id_accou1_1_0_,
        accounttyp0_.account_class as account_2_1_0_,
        accounttyp0_.name as name4_1_0_ 
    from
        account_type accounttyp0_ 
    where
        accounttyp0_.id_account_type=?
                
    select
        taxcode_db0_.id_tax_code as id_tax_c1_2_0_,
        taxcode_db0_.eid_tax_code as eid_tax_2_2_0_,
        taxcode_db0_.name as name3_2_0_ 
    from
        tax_code taxcode_db0_ 
    where
        taxcode_db0_.id_tax_code=?
                
    select
        taxcode_db0_.id_tax_code as id_tax_c1_2_0_,
        taxcode_db0_.eid_tax_code as eid_tax_2_2_0_,
        taxcode_db0_.name as name3_2_0_ 
    from
        tax_code taxcode_db0_ 
    where
        taxcode_db0_.id_tax_code=?
</pre> 
                                                            </div>
                                                        </div> <p style="margin: 10px 0 0">I looked into lazy="no-proxy" but that rabbit hole didn't work out:<br> I see that I can change every many-to-one to use lazy="no-proxy", but when I access any property it does 1 query to load all the foreign keys, and then does a separate query for each property's bean to fully populate it.<br> This would then force me to migrate from mappings to Annotations so I can use a separate @LazyGroup for each property.<br> I would also need to migrate every load()/find() to use a query that will left outer join fetch each property I want (or use an EntityGraph).<br> And after all that, when I try to access the property (that was already fetched) it still does an extra query to load the foreign key</p> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                                <tr> 
                                    <td class="email-content-main mobile-expand " style="padding: 0; border-collapse: collapse; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #ffffff" bgcolor="#ffffff"> <script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "EmailMessage",
  "description": "View Issue",
  "potentialAction": {
    "@type": "ViewAction",
        "target": "https://hibernate.atlassian.net/browse/HHH-11147?inbox=true&focusedCommentId=98305&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-98305",
    "name": "View Comment"
      },
  "publisher": {
    "@type": "Organization",
    "name": "Atlassian",
    "url": "https://www.atlassian.com"
  }
}
</script> 
                                        <table id="actions-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px"> 
                                            <tbody>
                                                <tr> 
                                                    <td id="actions-pattern-container" valign="middle" style="padding: 0; border-collapse: collapse; padding: 10px 0 10px 24px; vertical-align: middle; padding-left: 0"> 
                                                        <table align="left" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0"> 
                                                            <tbody>
                                                                <tr> 
                                                                    <td class="actions-pattern-action-icon-container" style="padding: 0; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 0; vertical-align: middle"> <a href="https://hibernate.atlassian.net/browse/HHH-11147#add-comment" target="_blank" title="Add Comment" style="color: #3b73af; text-decoration: none"> <img class="actions-pattern-action-icon-image" src="cid:jira-generated-image-static-comment-icon-ff2f4d72-ca68-4768-9c53-10450e94bd01" alt="Add Comment" title="Add Comment" height="16" width="16" border="0" style="vertical-align: middle"> </a> </td> 
                                                                    <td class="actions-pattern-action-text-container" style="padding: 0; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 4px; padding-left: 5px"> <a href="https://hibernate.atlassian.net/browse/HHH-11147#add-comment" target="_blank" title="Add Comment" style="color: #3b73af; text-decoration: none">Add Comment</a> </td> 
                                                                </tr> 
                                                            </tbody>
                                                        </table> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                                <!-- there needs to be content in the cell for it to render in some clients --> 
                                <tr> 
                                    <td class="email-content-rounded-bottom mobile-expand" style="padding: 0; border-collapse: collapse; color: #ffffff; padding: 0 15px 0 16px; height: 5px; line-height: 5px; background-color: #ffffff; border-top: 0; border-left: 1px solid #cccccc; border-bottom: 1px solid #cccccc; border-right: 1px solid #cccccc; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; mso-line-height-rule: exactly" height="5" bgcolor="#ffffff">&nbsp;</td> 
                                </tr> 
                            </tbody>
                        </table> </td> 
                </tr> 
                <tr> 
                    <td id="footer-pattern" style="padding: 0; border-collapse: collapse; padding: 12px 20px"> 
                        <table id="footer-pattern-container" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0"> 
                            <tbody>
                                <tr> 
                                    <td id="footer-pattern-mobile-separated-links" class="mobile-resize-text" width="100%" colspan="2" style="padding: 0; border-collapse: collapse; color: #999999; font-size: 12px; line-height: 18px; font-family: Arial, sans-serif; mso-line-height-rule: exactly; mso-text-raise: 2px"> Get JIRA notifications on your phone! Download the JIRA Cloud app for <a href="https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&amp;referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail" style="color: #3b73af; text-decoration: none">Android</a> or <a href="https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&amp;ct=EmailNotificationLink&amp;mt=8" style="color: #3b73af; text-decoration: none">iOS</a> 
                                        <hr> </td> 
                                </tr> 
                                <tr> 
                                    <td id="footer-pattern-text" class="mobile-resize-text" width="100%" style="padding: 0; border-collapse: collapse; color: #999999; font-size: 12px; line-height: 18px; font-family: Arial, sans-serif; mso-line-height-rule: exactly; mso-text-raise: 2px"> This message was sent by Atlassian JIRA <span id="footer-build-information">(v1000.1169.0#100058-<span title="8e1c62bb9876800576399a306a2625a39fa1166d" data-commit-id="8e1c62bb9876800576399a306a2625a39fa1166d}">sha1:8e1c62b</span>)</span> </td> 
                                    <td id="footer-pattern-logo-desktop-container" valign="top" style="padding: 0; border-collapse: collapse; padding-left: 20px; vertical-align: top"> 
                                        <table style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0"> 
                                            <tbody>
                                                <tr> 
                                                    <td id="footer-pattern-logo-desktop-padding" style="padding: 0; border-collapse: collapse; padding-top: 3px"> <img id="footer-pattern-logo-desktop" src="cid:jira-generated-image-static-footer-desktop-logo-e9920a3b-97f1-485a-a44a-f5bcbc19537a" alt="Atlassian logo" title="Atlassian logo" width="169" height="36" class="image_fix"> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                            </tbody>
                        </table> </td> 
                </tr> 
            </tbody>
        </table>   
    </body>
</html>