<!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://secure.gravatar.com/avatar/df12d7792bd3b7be3a4edf12cabd58cb?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: 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="steve" id="email_steve" href="https://hibernate.atlassian.net/secure/ViewProfile.jspa?name=steve" style="color:#6c797f;; color: #3b73af; text-decoration: none">Steve Ebersole</a> <strong>commented</strong> on <a href="https://hibernate.atlassian.net/browse/HHH-11356" style="color: #3b73af; text-decoration: none"><img src="cid:jira-generated-image-avatar-9ca2666d-89c1-4e8a-85a8-1ebacd00c292" height="16" width="16" border="0" align="absmiddle" alt="Improvement"> HHH-11356</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-11356" style="color: #3b73af; text-decoration: none">Re: Adjust the 2nd-Cache SPIs to better reflect supported uses</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"> 
                                                        <blockquote style="margin: 10px 0 0; margin-top: 0; border-left: 1px solid #cccccc; color: #707070; margin-left: 19px; padding: 10px 20px"> 
                                                            <p style="margin: 10px 0 0; margin-top: 0">CacheAccess sounds fine...<br> {quote&gt;</p> 
                                                            <p style="margin: 10px 0 0">I ended up calling it <tt>org.hibernate.cache.spi.access.StorageAccess</tt> for the time being. I had changed that before your reply. The idea being that this represents access to the underlying cache storage. <tt>CacheAccess</tt> is fine for me too; we can change it later if we all think it makes more sense.</p> 
                                                        </blockquote> <p style="margin: 10px 0 0">it has a feeling of the cache being something external to ORM. I rather think about cache as totally owned component, despite that the implementation uses different project. While you repeat that everything should be expressed from Hibernate side (and I agree to that), Hibernate and Cache does not have a peer relationship.</p> 
                                                        <blockquote style="margin: 10px 0 0; border-left: 1px solid #cccccc; color: #707070; margin-left: 19px; padding: 10px 20px"> 
                                                            <p style="margin: 10px 0 0; margin-top: 0">I am not following what you mean by "Hibernate and Cache does not have a peer relationship". What do you mean by that?</p> 
                                                            <p style="margin: 10px 0 0">I will say however that I do not think it always makes sense to think of caching as a "totally owned component" in terms of thinking Hibernate owns it. To me whoever builds something, owns it. In general Hibernate does not finely control how the provider should build Caches, etc. Nor should it. Ok, you can argue that, e.g., <tt>hibernate-infinispan</tt> is doing this and is Hibernate... sure. But, for example, when Hibernate is used in WildFly, WildFly configures those caches for Hibernate to use - Hibernate does not own it, WildFly does.</p> 
                                                        </blockquote> <p style="margin: 10px 0 0">Ad cache per region vs. cache per region access: cache per Region has an implementation problem with</p> <p style="margin: 10px 0 0">@Cache(region="a.b.c",usage=TRANSACTIONAL)<br> public class Person </p> { ... }<br> <br> @Cache(region="a.b.c",usage=NONSTRICT_READ_WRITE)<br> public class Animal { ... } <p style="margin: 10px 0 0">and I am a bit afraid of cache per RegionAccess (in that case you couldn't set max cache size for multiple entities together - this is possible in the current codebase). So I would prefer being able to store multiple roles with the same access type in single cache (and being smart about CacheKeysFactory), while having separate caches "a.b.c#TX" and "a.b.c#NSRW".</p> 
                                                        <blockquote style="margin: 10px 0 0; border-left: 1px solid #cccccc; color: #707070; margin-left: 19px; padding: 10px 20px"></blockquote> <p style="margin: 10px 0 0">Additionally, I ran into another oddity regarding query-result and update-timestamps caches. Some of this I mentioned earlier when I said that I do not think it makes sense conceptually to mix entity, collection and natural-id storage with query-result and update-timestamps storage in the same "region". And in fact update-timestamps storage is more properly modeled related to the RegionFactory than a specific Region.</p> <p style="margin: 10px 0 0">Its as if "region name" means a different thing when we discuss entity, collection and natural-id caching versus query-result caching. </p> <p style="margin: 10px 0 0">For the case of entity, collection and natural-id Region could be interpreted as either:</p> 
                                                        <ol> 
                                                            <li>cache per region</li> 
                                                            <li>cache per "cacheable"</li> 
                                                        </ol> <p style="margin: 10px 0 0">(here I use "cache" as in underlying provider cache object)</p> <p style="margin: 10px 0 0">In either case, region-name indicates the config (interceptors, replication, etc) to use<span class="error">[1]</span> - in (1) it is applied to the single cache instance, whereas in (2) the config is applied to a cache created for each "cacheable". Also, it is important to keep in mind that in (1) cache keys still need to incorporate the "cacheable" name if other "cacheable"s of the same type are also associated with this region (to properly segment the data from each cacheable); but in the case of (2) it is <b>always</b> safe to drop the "cacheable" name there.</p> <p style="margin: 10px 0 0">Each approach has pros and cons; it is really ultimately a provider choice. </p> <p style="margin: 10px 0 0">In the case of query-result caching, I think the provider should be safe to interpret Region as either:</p> 
                                                        <ol> 
                                                            <li>cache per region</li> 
                                                            <li>one cache per RegionFactory for all query-result caching</li> 
                                                        </ol> <p style="margin: 10px 0 0">Additionally, query-result (and update-timestamps) caching storage is accessed directly, without "access" protection (as is done for entity, collection and natural-id caching).</p> <p style="margin: 10px 0 0">Also too, here the notion of a Region becomes very different. Where for entity, collection and natural-id I'd actually </p> <p style="margin: 10px 0 0">I have an idea for a tweak to the design to better account for these, but it represents a conceptual change that I wanted to get y'alls thoughts on. Basically I'd introduce the notion of a "Cache" </p> <p style="margin: 10px 0 0">I bring up this discussion in context of your "mixed access" discussion because I think you could actually support that if you chose the "each entity Region gets its own Cache" path - since Cache seems to be lowest place you can deal with the idea of "access". Or you could just disallow that, which I am ok with providers deciding to do (we should just be clear about this in the documentation). What you propose also seems very reasonable thing for a provider to do.</p> <p style="margin: 10px 0 0">As far as applying maxEntries, etc across a Region with multiple access types defined your proposal also does not handle that because it is creating separate caches (while having separate caches "a.b.c#TX" and "a.b.c#NSRW"). </p> <p style="margin: 10px 0 0">Personally I do not see the difficulty in supporting multiple access types against a single cache, but I have not dug into the details of implementing a provider nearly as much as you have.</p> <p style="margin: 10px 0 0"><span class="error">[1]</span> This is my proposal, that the region name ought to be part of a fallback resolution for the cache config to use - specifically to come to an agreement on that between the providers. It makes for a better Hibernate user experience and I'd love if we could all agree to a fallback sequence of (highest precedence to lowest):</p> 
                                                        <ol> 
                                                            <li>"cacheable" name (Person, Animal)</li> 
                                                            <li>region-name ("a.b.c")</li> 
                                                            <li>cacheable type ("hibernate-entity", "hibernate-collection", "hibernate-natural-id", "hibernate-query-results")</li> 
                                                        </ol> </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-11356?inbox=true&focusedCommentId=90412&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-90412",
    "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-11356#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-27acd2c1-1310-42b9-ad31-33ac3b6fe4b6" 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-11356#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-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.769.0#100032-<span title="9e9bf17c5737720b1a82e207295ee07983225c89" data-commit-id="9e9bf17c5737720b1a82e207295ee07983225c89}">sha1:9e9bf17</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-d833cff7-2ddf-4775-818c-d33a1d3ee486" 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>