<!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: #333; 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: 0pt; mso-table-rspace: 0pt; background-color: #f5f5f5; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt"> 
            <!-- header here --> 
            <tr> 
                <td id="header-pattern-container" style="padding: 0px; border-collapse: collapse; padding: 10px 20px"> 
                    <table id="header-pattern" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt"> 
                        <tr> 
                            <td id="header-avatar-image-container" valign="top" style="padding: 0px; border-collapse: collapse; vertical-align: top; width: 32px; padding-right: 8px"> <img id="header-avatar-image" class="image_fix" src="https://secure.gravatar.com/avatar/c32c4103dacf291cdfa0439e34f2c07e?d=mm&amp;s=48" height="32" width="32" border="0" style="border-radius: 3px; vertical-align: top" /> 
                            </td> 
                            <td id="header-text-container" valign="middle" style="padding: 0px; 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="gbadner" id="email_gbadner" href="https://hibernate.atlassian.net/secure/ViewProfile.jspa?name=gbadner" style="color:#6c797f;; color: #3b73af; text-decoration: none">Gail Badner</a> <strong>updated</strong> an issue 
                            </td> 
                        </tr> 
                    </table> 
                </td> 
            </tr> 
            <tr> 
                <td id="email-content-container" style="padding: 0px; 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: 0pt; mso-table-rspace: 0pt; border-spacing: 0; border-collapse: separate"> 
                        <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: 0px; border-collapse: collapse; color: #fff; padding: 0 15px 0 16px; height: 15px; background-color: #fff; border-left: 1px solid #ccc; border-top: 1px solid #ccc; border-right: 1px solid #ccc; 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">
                                &nbsp;
                            </td> 
                        </tr> 
                        <tr> 
                            <td class="email-content-main mobile-expand " style="padding: 0px; border-collapse: collapse; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #fff"> 
                                <table class="page-title-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt"> 
                                    <tr> 
                                        <td class="page-title-pattern-first-line " style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; padding-top: 10px"> <a href="https://hibernate.atlassian.net/browse/HHH" style="color: #3b73af; text-decoration: none">Hibernate ORM</a> / <a href="https://hibernate.atlassian.net/browse/HHH-9261" style="color: #3b73af; text-decoration: none"><img src="cid:jira-generated-image-static-bug-758b7fca-66b4-4ba9-aa28-6df4994e14b0" height="16" width="16" border="0" align="absmiddle" alt="Bug" style="vertical-align: text-bottom" /></a> <a href="https://hibernate.atlassian.net/browse/HHH-9261" style="color: #3b73af; text-decoration: none">HHH-9261</a> 
                                        </td> 
                                    </tr> 
                                    <tr> 
                                        <td style="vertical-align: top;; padding: 0px; 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-9261" style="color: #3b73af; text-decoration: none">Backport HHH-9106 to 4.2 (Multiple representations of the same entity cannot be merged using cascade=merge)</a> </span> 
                                        </td> 
                                    </tr> 
                                </table> 
                            </td> 
                        </tr> 
                        <tr> 
                            <td class="email-content-main mobile-expand  wrapper-special-margin" style="padding: 0px; border-collapse: collapse; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #fff; padding-top: 10px; padding-bottom: 5px"> 
                                <table class="keyvalue-table" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt"> 
                                    <tr> 
                                        <th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">
                                            Change By:
                                        </th> 
                                        <td style="padding: 0px; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> <a class="user-hover" rel="gbadner" id="email_gbadner" href="https://hibernate.atlassian.net/secure/ViewProfile.jspa?name=gbadner" style="color:#6c797f;; color: #3b73af; text-decoration: none">Gail Badner</a> 
                                        </td> 
                                    </tr> 
                                </table> 
                            </td> 
                        </tr> 
                        <tr> 
                            <td class="email-content-main mobile-expand  issue-description-container" style="padding: 0px; border-collapse: collapse; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #fff; padding-top: 5px; padding-bottom: 10px"> 
                                <table class="text-paragraph-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 2px"> 
                                    <tr> 
                                        <td class="text-paragraph-pattern-container mobile-resize-text " style="padding: 0px; border-collapse: collapse; padding: 0 0 10px 0"> <span class="diffaddedchars" style="background-color:#ddfade;">Documentation&nbsp;will&nbsp;be&nbsp;added&nbsp;to&nbsp;the&nbsp;manual&nbsp;by&nbsp;HHH-9216.&nbsp;Here&nbsp;is&nbsp;some&nbsp;documentation&nbsp;to&nbsp;get&nbsp;people&nbsp;going.<br /><br />OVERVIEW:<br /><br />A&nbsp;new&nbsp;configuration&nbsp;property,&nbsp;hibernate.event.merge.entity_copy_observer,&nbsp;controls&nbsp;how&nbsp;Hibernate&nbsp;will&nbsp;respond&nbsp;when&nbsp;multiple&nbsp;representations&nbsp;of&nbsp;the&nbsp;same&nbsp;persistent&nbsp;entity&nbsp;(&quot;entity&nbsp;copy&quot;)&nbsp;is&nbsp;detected&nbsp;while&nbsp;merging.<br /><br />hibernate.event.merge.entity_copy_observer&nbsp;can&nbsp;be&nbsp;set&nbsp;to&nbsp;one&nbsp;of&nbsp;the&nbsp;following&nbsp;values:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;disallow&nbsp;(the&nbsp;default):&nbsp;throws&nbsp;IllegalStateException&nbsp;if&nbsp;an&nbsp;entity&nbsp;copy&nbsp;is&nbsp;detected;<br />&nbsp;&nbsp;&nbsp;&nbsp;allow:&nbsp;performs&nbsp;the&nbsp;merge&nbsp;operation&nbsp;on&nbsp;each&nbsp;entity&nbsp;copy&nbsp;that&nbsp;is&nbsp;detected;<br />&nbsp;&nbsp;&nbsp;&nbsp;log:&nbsp;(provided&nbsp;for&nbsp;testing&nbsp;only)&nbsp;performs&nbsp;the&nbsp;merge&nbsp;operation&nbsp;on&nbsp;each&nbsp;entity&nbsp;copy&nbsp;that&nbsp;is&nbsp;detected&nbsp;and&nbsp;logs&nbsp;information&nbsp;about&nbsp;the&nbsp;entity&nbsp;copies.&nbsp;This&nbsp;setting&nbsp;requires&nbsp;DEBUG&nbsp;logging&nbsp;be&nbsp;enabled&nbsp;for&nbsp;org.hibernate.event.internal.EntityCopyAllowedLoggedObserver.<br /><br />In&nbsp;addition&nbsp;the&nbsp;application&nbsp;may&nbsp;customize&nbsp;the&nbsp;behavior&nbsp;by&nbsp;providing&nbsp;an&nbsp;implementation&nbsp;of&nbsp;org.hibernate.event.spi.EntityCopyObserver&nbsp;and&nbsp;setting&nbsp;hibernate.event.merge.entity_copy_observer&nbsp;to&nbsp;the&nbsp;class&nbsp;name.<br /><br />When&nbsp;hibernate.event.merge.entity_copy_observer=allow&nbsp;or&nbsp;log,&nbsp;Hibernate&nbsp;will&nbsp;merge&nbsp;each&nbsp;entity&nbsp;copy&nbsp;detected&nbsp;while&nbsp;cascading&nbsp;the&nbsp;merge&nbsp;operation.&nbsp;In&nbsp;the&nbsp;process&nbsp;of&nbsp;merging&nbsp;each&nbsp;entity&nbsp;copy,&nbsp;Hibernate&nbsp;will&nbsp;cascade&nbsp;the&nbsp;merge&nbsp;operation&nbsp;from&nbsp;each&nbsp;entity&nbsp;copy&nbsp;to&nbsp;its&nbsp;assocations&nbsp;with&nbsp;cascade=CascadeType.MERGE&nbsp;or&nbsp;CascadeType.ALL.&nbsp;The&nbsp;entity&nbsp;state&nbsp;resulting&nbsp;from&nbsp;merging&nbsp;an&nbsp;entity&nbsp;copy&nbsp;will&nbsp;be&nbsp;overwritten&nbsp;when&nbsp;another&nbsp;entity&nbsp;copy&nbsp;is&nbsp;merged.<br /><br />There&nbsp;are&nbsp;no&nbsp;known&nbsp;issues&nbsp;with&nbsp;merging&nbsp;multiple&nbsp;entity&nbsp;copies&nbsp;as&nbsp;long&nbsp;as&nbsp;they&nbsp;are&nbsp;consistent&nbsp;(i.e.&nbsp;have&nbsp;the&nbsp;same&nbsp;property/association&nbsp;values).<br /><br />RISKS&nbsp;OF&nbsp;MERGING&nbsp;ENTITY&nbsp;COPIES:<br /><br />Because&nbsp;cascade&nbsp;order&nbsp;is&nbsp;undefined,&nbsp;the&nbsp;order&nbsp;in&nbsp;which&nbsp;the&nbsp;entity&nbsp;copies&nbsp;are&nbsp;merged&nbsp;is&nbsp;undefined.&nbsp;As&nbsp;a&nbsp;result,&nbsp;if&nbsp;property&nbsp;values&nbsp;in&nbsp;the&nbsp;entity&nbsp;copies&nbsp;are&nbsp;not&nbsp;consistent,&nbsp;the&nbsp;resulting&nbsp;entity&nbsp;state&nbsp;will&nbsp;be&nbsp;indeterminate&nbsp;and&nbsp;data&nbsp;will&nbsp;be&nbsp;lost&nbsp;from&nbsp;all&nbsp;entity&nbsp;copies&nbsp;except&nbsp;for&nbsp;the&nbsp;last&nbsp;one&nbsp;merged.<br /><br />If&nbsp;an&nbsp;entity&nbsp;copy&nbsp;cascades&nbsp;the&nbsp;merge&nbsp;operation&nbsp;to&nbsp;an&nbsp;association&nbsp;that&nbsp;is&nbsp;(or&nbsp;contains)&nbsp;a&nbsp;new&nbsp;entity,&nbsp;that&nbsp;new&nbsp;entity&nbsp;will&nbsp;be&nbsp;merged&nbsp;(i.e,&nbsp;persisted&nbsp;and&nbsp;the&nbsp;merge&nbsp;operation&nbsp;will&nbsp;be&nbsp;cascaded&nbsp;to&nbsp;its&nbsp;associations&nbsp;according&nbsp;to&nbsp;its&nbsp;mapping),&nbsp;even&nbsp;if&nbsp;that&nbsp;same&nbsp;association&nbsp;is&nbsp;ultimately&nbsp;overwritten&nbsp;when&nbsp;Hibernate&nbsp;merges&nbsp;a&nbsp;different&nbsp;representation&nbsp;having&nbsp;a&nbsp;different&nbsp;value&nbsp;for&nbsp;its&nbsp;association.&nbsp;If&nbsp;the&nbsp;association&nbsp;is&nbsp;mapped&nbsp;with&nbsp;orphanRemoval=true,&nbsp;the&nbsp;new&nbsp;entity&nbsp;will&nbsp;not&nbsp;be&nbsp;deleted&nbsp;because&nbsp;the&nbsp;semantics&nbsp;of&nbsp;orphanRemoval&nbsp;do&nbsp;not&nbsp;apply&nbsp;if&nbsp;the&nbsp;entity&nbsp;being&nbsp;orphaned&nbsp;is&nbsp;a&nbsp;new&nbsp;entity.<br /><br />There&nbsp;are&nbsp;known&nbsp;issues&nbsp;when&nbsp;representations&nbsp;of&nbsp;the&nbsp;same&nbsp;persistent&nbsp;entity&nbsp;have&nbsp;different&nbsp;values&nbsp;for&nbsp;a&nbsp;collection.&nbsp;See&nbsp;HHH-9239&nbsp;and&nbsp;HHH-9240&nbsp;for&nbsp;details.&nbsp;These&nbsp;issues&nbsp;can&nbsp;cause&nbsp;data&nbsp;loss&nbsp;or&nbsp;corruption.<br /><br />By&nbsp;setting&nbsp;hibernate.event.merge.entity_copy_observer=allow&nbsp;or&nbsp;log,&nbsp;Hibernate&nbsp;will&nbsp;allow&nbsp;entity&nbsp;copies&nbsp;of&nbsp;any&nbsp;type&nbsp;of&nbsp;entity&nbsp;to&nbsp;be&nbsp;merged.&nbsp;The&nbsp;only&nbsp;way&nbsp;to&nbsp;exclude&nbsp;particular&nbsp;entity&nbsp;classes&nbsp;or&nbsp;associations&nbsp;that&nbsp;contain&nbsp;critical&nbsp;data&nbsp;is&nbsp;to&nbsp;provide&nbsp;a&nbsp;custom&nbsp;implementation&nbsp;of&nbsp;org.hibernate.event.spi.EntityCopyObserver&nbsp;with&nbsp;the&nbsp;desired&nbsp;behavior,&nbsp;and&nbsp;setting&nbsp;hibernate.event.merge.entity_copy_observer&nbsp;to&nbsp;the&nbsp;class&nbsp;name.<br /><br />RECOMMENDATIONS:<br /><br />Hibernate&nbsp;provides&nbsp;limited&nbsp;DEBUG&nbsp;logging&nbsp;capabilities&nbsp;that&nbsp;can&nbsp;help&nbsp;determine&nbsp;the&nbsp;entity&nbsp;classes&nbsp;for&nbsp;which&nbsp;entity&nbsp;copies&nbsp;were&nbsp;found.&nbsp;By&nbsp;setting&nbsp;hibernate.event.merge.entity_copy_observer=log&nbsp;and&nbsp;enabling&nbsp;DEBUG&nbsp;logging&nbsp;for&nbsp;org.hibernate.event.internal.EntityCopyAllowedLoggedObserver,&nbsp;the&nbsp;following&nbsp;will&nbsp;be&nbsp;logged&nbsp;each&nbsp;time&nbsp;an&nbsp;application&nbsp;calls&nbsp;EntityManager.merge(&nbsp;entity&nbsp;)&nbsp;or&nbsp;Session.merge(&nbsp;entity&nbsp;):<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;number&nbsp;of&nbsp;times&nbsp;multiple&nbsp;representations&nbsp;of&nbsp;the&nbsp;same&nbsp;persistent&nbsp;entity&nbsp;was&nbsp;detected&nbsp;summarized&nbsp;by&nbsp;entity&nbsp;name;<br />&nbsp;&nbsp;&nbsp;&nbsp;details&nbsp;by&nbsp;entity&nbsp;name&nbsp;and&nbsp;ID,&nbsp;including&nbsp;output&nbsp;from&nbsp;calling&nbsp;toString()&nbsp;on&nbsp;each&nbsp;representation&nbsp;being&nbsp;merged&nbsp;as&nbsp;well&nbsp;as&nbsp;the&nbsp;merge&nbsp;result.<br /><br />The&nbsp;log&nbsp;should&nbsp;be&nbsp;reviewed&nbsp;to&nbsp;determine&nbsp;if&nbsp;multiple&nbsp;representations&nbsp;of&nbsp;entities&nbsp;containing&nbsp;critical&nbsp;data&nbsp;are&nbsp;detected.&nbsp;If&nbsp;so,&nbsp;the&nbsp;application&nbsp;should&nbsp;be&nbsp;modified&nbsp;so&nbsp;there&nbsp;is&nbsp;only&nbsp;one&nbsp;representation,&nbsp;and&nbsp;a&nbsp;custom&nbsp;implementation&nbsp;of&nbsp;org.hibernate.event.spi.EntityCopyObserver&nbsp;should&nbsp;be&nbsp;provided&nbsp;to&nbsp;disallow&nbsp;entity&nbsp;copies&nbsp;for&nbsp;entities&nbsp;with&nbsp;critical&nbsp;data.<br /><br />Using&nbsp;optimistic&nbsp;locking&nbsp;is&nbsp;recommended&nbsp;to&nbsp;detect&nbsp;if&nbsp;different&nbsp;representations&nbsp;are&nbsp;from&nbsp;different&nbsp;versions&nbsp;of&nbsp;the&nbsp;same&nbsp;persistent&nbsp;entity.&nbsp;If&nbsp;they&nbsp;are&nbsp;not&nbsp;from&nbsp;the&nbsp;same&nbsp;version,&nbsp;Hibernate&nbsp;will&nbsp;throw&nbsp;StaleObjectStateException.</span> 
                                        </td> 
                                    </tr> 
                                </table> 
                            </td> 
                        </tr> 
                        <tr> 
                            <td class="email-content-main mobile-expand " style="padding: 0px; border-collapse: collapse; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #fff"> 
                                <table id="actions-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px"> 
                                    <tr> 
                                        <td id="actions-pattern-container" valign="middle" style="padding: 0px; border-collapse: collapse; padding: 10px 0 10px 24px; vertical-align: middle; padding-left: 0"> 
                                            <table align="left" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt"> 
                                                <tr> 
                                                    <td class="actions-pattern-action-icon-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 0px; vertical-align: middle"> <a href="https://hibernate.atlassian.net/browse/HHH-9261#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-286be5fb-5b48-4c6f-85df-cd7f010d7d22" 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: 0px; 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-9261#add-comment" target="_blank" title="Add Comment" style="color: #3b73af; text-decoration: none">Add Comment</a> 
                                                    </td> 
                                                </tr> 
                                            </table> 
                                        </td> 
                                    </tr> 
                                </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: 0px; border-collapse: collapse; color: #fff; padding: 0 15px 0 16px; height: 5px; line-height: 5px; background-color: #fff; border-top: 0; border-left: 1px solid #ccc; border-bottom: 1px solid #ccc; border-right: 1px solid #ccc; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; mso-line-height-rule: exactly">
                                &nbsp;
                            </td> 
                        </tr> 
                    </table> 
                </td> 
            </tr> 
            <tr> 
                <td id="footer-pattern" style="padding: 0px; border-collapse: collapse; padding: 12px 20px"> 
                    <table id="footer-pattern-container" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt"> 
                        <tr> 
                            <td id="footer-pattern-text" class="mobile-resize-text" width="100%" style="padding: 0px; border-collapse: collapse; color: #999; 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">(v6.3-OD-08-005-WN#6328-<span title="aae40f7178774ac0c2b0a349d29c88f14216faa1" data-commit-id="aae40f7178774ac0c2b0a349d29c88f14216faa1}">sha1:aae40f7</span>)</span> 
                            </td> 
                            <td id="footer-pattern-logo-desktop-container" valign="top" style="padding: 0px; border-collapse: collapse; padding-left: 20px; vertical-align: top"> 
                                <table style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt"> 
                                    <tr> 
                                        <td id="footer-pattern-logo-desktop-padding" style="padding: 0px; border-collapse: collapse; padding-top: 3px"> <img id="footer-pattern-logo-desktop" src="cid:jira-generated-image-static-footer-desktop-logo-c8a89102-cea8-4b3b-a234-a78edb7937d1" alt="Atlassian logo" title="Atlassian logo" width="169" height="36" class="image_fix" /> 
                                        </td> 
                                    </tr> 
                                </table> 
                            </td> 
                        </tr> 
                    </table> 
                </td> 
            </tr> 
        </table>   
    </body>
</html>