<!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/f32e2c7157c84dddcb339d0714bb6025?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="wernerg" id="email_wernerg" href="https://hibernate.atlassian.net/secure/ViewProfile.jspa?name=wernerg" style="color:#6c797f;; color: #3b73af; text-decoration: none">Werner Gindhart</a> <strong>created</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-8808" style="color: #3b73af; text-decoration: none"><img src="https://hibernate.atlassian.net/images/icons/issuetypes/newfeature.png" height="16" width="16" border="0" align="absmiddle" alt="New Feature" style="vertical-align: text-bottom" /></a> <a href="https://hibernate.atlassian.net/browse/HHH-8808" style="color: #3b73af; text-decoration: none">HHH-8808</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-8808" style="color: #3b73af; text-decoration: none">Navigable historization of entities and associations</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">
                                            Issue Type:
                                        </th> 
                                        <td class="has-icon" style="padding: 0px; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> <img src="https://hibernate.atlassian.net/images/icons/issuetypes/newfeature.png" height="16" width="16" border="0" align="absmiddle" alt="New Feature" style="vertical-align: text-bottom" /> New Feature 
                                        </td> 
                                    </tr> 
                                    <tr> 
                                        <th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">
                                            Affects Versions:
                                        </th> 
                                        <td style="padding: 0px; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top">
                                             4.3.0.CR2, 5.0.0 
                                        </td> 
                                    </tr> 
                                    <tr> 
                                        <th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">
                                            Assignee:
                                        </th> 
                                        <td style="padding: 0px; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top">
                                             Unassigned 
                                        </td> 
                                    </tr> 
                                    <tr> 
                                        <th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">
                                            Components:
                                        </th> 
                                        <td style="padding: 0px; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top">
                                             annotations, core, envers, metamodel 
                                        </td> 
                                    </tr> 
                                    <tr> 
                                        <th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">
                                            Created:
                                        </th> 
                                        <td style="padding: 0px; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top">
                                             19/Dec/13 4:44 AM 
                                        </td> 
                                    </tr> 
                                    <tr> 
                                        <th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">
                                            Labels:
                                        </th> 
                                        <td style="padding: 0px; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top">
                                             historization 
                                        </td> 
                                    </tr> 
                                    <tr> 
                                        <th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">
                                            Priority:
                                        </th> 
                                        <td class="has-icon" style="padding: 0px; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> <img src="https://hibernate.atlassian.net/images/icons/priorities/major.png" height="16" width="16" border="0" align="absmiddle" alt="Major" style="vertical-align: text-bottom" /> Major 
                                        </td> 
                                    </tr> 
                                    <tr> 
                                        <th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">
                                            Reporter:
                                        </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="wernerg" id="email_wernerg" href="https://hibernate.atlassian.net/secure/ViewProfile.jspa?name=wernerg" style="color:#6c797f;; color: #3b73af; text-decoration: none">Werner Gindhart</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"> 
                                            <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0 0">&lt;p&gt;&lt;b&gt;Use case:&lt;/b&gt;<br /> &lt;br&gt;A company has associated some stuff like houses, persons, buildings. <br /> The objects and associations change over time as well as in quality (e.g. building is rented, owned ...).</p> 
                                            <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0 0">Now the company wants to build reports of the company state for certain different points of time in past,<br /> without having to adapt the report definition to recognize the point of time definition or specific historization tools like Hibernate Envers.</p> 
                                            <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0 0">&lt;p&gt;&lt;b&gt;Problem description:&lt;/b&gt;<br /> There is a currently effective set of objects which can be easily queried by hibernate (JPQL) selects.</p> 
                                            <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0 0">If some changes are made, this can be documented via Hibernate Envers, storing old object versions in separate tables.<br /> But if you want to retrieve a complete set of objects valid for a certain due date (or timestamp value), <br /> you have to do some special Envers queries which causes many extra coding.<br /> If you want to do some reporting using JasperReports or BIRT navigating via JPQL you can not use these tools<br /> without writing new report definitions (if possible with envers at all).</p> 
                                            <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0 0">&lt;p&gt;&lt;b&gt;Proposed solution principle:&lt;/b&gt;<br /> &lt;ol&gt;<br /> &lt;li&gt;In every session must be defined a query effectivity item (date or timestamp) which defines the point of interest in time for which all queries within this session will be processed.<br /> &lt;br&gt;If not set, the current time is used as point of interest in time.&lt;/li&gt;<br /> &lt;li&gt;Every entity relevant for historization must define an effectivity time span, which will define the set of of entity objects valid for all queries.&lt;/li&gt;<br /> &lt;li&gt;The different versions of the same object build up an logical domain.<br /> &lt;br&gt;If an query effectivity item is set in session, then at most ONE object of every object domain will be found by a any query.&lt;br&gt;<br /> &lt;/li&gt;<br /> &lt;/ol&gt;</p> 
                                            <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0 0">&lt;p&gt;&lt;b&gt;Proposed hibernate solution (theory):&lt;/b&gt;<br /> &lt;br&gt;&lt;b&gt;All following definitions apply only to entities relevant for historization.&lt;/b&gt;&lt;br&gt;Entities not relevant for historization are handled as before.<br /> &lt;ol&gt;<br /> &lt;li&gt;The session accepts an Calender value which defines the current point of interest in time for all subsequent queries. Lets call it &quot;Session Effectivity Criteria&quot;.<br /> &lt;br&gt;For possibly influencing all formerly read objects, the object cache of the session must be cleared , when this value is set.<br /> &lt;br&gt;If not set, the current time is used as criteria.<br /> Of course, a flush operation may be neccessary, too.&lt;/li&gt;<br /> &lt;li&gt;Every entity must define two temporal attributes which define the effectivity time span for an object version.<br /> &lt;br&gt;Lets call them &quot;Effectivity Start&quot; and &quot;Effectivity End&quot;<br /> &lt;br&gt;When persisting an objects version there are three rules to be checked:<br /> &lt;ol&gt;<br /> &lt;li&gt;&quot;Effectivity Start&quot; and &quot;Effectivity End&quot; must both not be null.&lt;br&gt;This is because it's easier and probably faster to search with only one &quot;between&quot; expression.&lt;/li&gt;<br /> &lt;li&gt;&quot;Effectivity Start&quot; must be less than &quot;Effectivity End&quot;.&lt;/li&gt;<br /> &lt;li&gt;Within an object domain there must not be other object versions which overlap the same effectivity time span as the object to be persisted.&lt;/li&gt;<br /> &lt;/ol&gt; <br /> &lt;/li&gt;<br /> &lt;li&gt;For identification of the objects different time dependent versions of the same object (object domain) the entity must defined an attribute which works as a link between the separate versions.<br /> Lets call it &quot;Object Domain Id&quot;.&lt;br&gt;All different versions of an object have an &quot;Object Domain Id&quot; of the same value.&lt;/li&gt;<br /> &lt;li&gt;All association definitions like @ManyToOne, @OneToOne, @OneToMany targeting to an entity relevant for historization, do not implicitly relate to the objects id, but to the &quot;Object Domain Id&quot;&lt;/li&gt;<br /> &lt;li&gt;All select operations for an entity add an additional fragment to the where clause which limit the found objects to this condition :&lt;br&gt;&lt;i&gt;&quot;Effectivity Start&quot; &lt;b&gt;&lt;=&lt;/b&gt; &quot;Session Effectivity Criteria&quot; &lt;b&gt;&lt;&lt;/b&gt; &quot;Effectivity End&quot;.<br /> &lt;br&gt;This applies to all select operations except those which define load operations needing explicitely use of the object id (e.g. load for UPGRADE, PESSIMISTIC_READ etc.).<br /> &lt;/li&gt;<br /> &lt;/ol&gt;</p> 
                                            <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0 0">&lt;p&gt;&lt;b&gt;Proposed hibernate solution (practice):&lt;/b&gt;<br /> &lt;ol&gt;<br /> &lt;li&gt;The interface &quot;org.hibernate.Session&quot; (and its derived classes) must be expanded by follwing methodes:<br /> &lt;ul&gt;<br /> &lt;li&gt;setEffectivityCriteria(java.util.Calendar)&lt;br&gt;Set the &quot;Session Effectivity Criteria&quot;,so that this point of time is used as effectivity criteria within further queries of the session.&lt;/li&gt;<br /> &lt;li&gt;resetEffectivityCriteria()&lt;br&gt;Reset the &quot;Session Effectivity Criteria&quot;,so that the current time is used as effectivity criteria within further queries of the session.&lt;/li&gt;<br /> &lt;li&gt;List&lt;java.util.Calendar&gt;getEffectivityStarts(java.lang.Object entityObject, java.util.Calendar earliestStart, java.util.Calendar latestStart, int maxResults)<br /> &lt;br&gt;Returns an ordered by timestamp list of effectivity start points of time for a certain object (respectively the domain of this object).<br /> &lt;br&gt;The parameter &quot;earliestStart&quot; means that, if it exists, the effectivity start point of the object should returned, which has been valid at earliestStart. <br /> &lt;br&gt;That means the first returned effectivity start point can be less than the value of the &quot;earliestStart&quot; parameter.<br /> &lt;br&gt;This method can be used to determine which versions of an object exist.&lt;/li&gt;<br /> &lt;/ul&gt;<br /> &lt;li&gt;An Annotation &quot;@EffectivtyDomainId&quot; will be introduced which defines the &quot;Object Domain Id&quot;-Attribute of the entity.<br /> &lt;br&gt;May be this should automatically imply &quot;nullable = false&quot; and &quot;updateable = false&quot;.&lt;/li&gt;<br /> &lt;li&gt;Two Annotations &quot;@EffectivtyStart&quot; and &quot;@EffectivtyStart&quot; will be introduced which define the &quot;Effectivity Start&quot; and &quot;Effectivity End&quot;-Attributes of the entity.<br /> &lt;br&gt;The annotated attribute must be annotated by @Temporal, too.<br /> &lt;br&gt;May be this should automatically imply &quot;nullable = false&quot;.<br /> &lt;/li&gt;<br /> &lt;li&gt;Adaption of the classes &quot;org.hibernate.hql.internal.antlr.HqlSqlBaseWalker&quot; and &quot;org.hibernate.hql.internal.ast.HqlSqlWalker&quot; <br /> and may be others for application of the &quot;Object Domain Id&quot;-Attribute instead of the &quot;Id&quot;-Attribute for all applicable queries.<br /> Especially regarding joins between and to historizable entities&lt;br&gt;&lt;/li&gt;<br /> &lt;/ol&gt;</p> 
                                            <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0 0">&lt;p&gt;&lt;b&gt;Possible cooperation with Envers:&lt;/b&gt;<br /> &lt;br&gt;If the value of an entity attribute changes without change of the effectivity span of the object, Envers could be used for tracking the changes (regarding what / who).<br /> &lt;p&gt;<br /> If the value of an entity attribute changes from a certain point of time on (e.g. directly chronologically following), <br /> then the &quot;old&quot; version of the object will be changed in &quot;Effectivity End&quot; and a new copy of the object with new effectivity bounds will be created.<br /> &lt;br&gt;In this case Envers tracks the values too (for forensic purposes), but effectivty sensible reports will only read the main entities.</p> 
                                        </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-8808#add-comment" target="_blank" title="Add Comment" style="color: #3b73af; text-decoration: none"> <img class="actions-pattern-action-icon-image" src="https://hibernate.atlassian.net/images/mail/comment-icon.png" 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-8808#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.2-OD-05-4#6207-<span title="cd2d72fc0cc1a6ce24fcef98c746fc7603bc8943" data-commit-id="cd2d72fc0cc1a6ce24fcef98c746fc7603bc8943}">sha1:cd2d72f</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="https://hibernate.atlassian.net/images/mail/footer-desktop-logo.png" alt="Atlassian logo" title="Atlassian logo" width="169" height="36" class="image_fix" /> 
                                        </td> 
                                    </tr> 
                                </table> 
                            </td> 
                        </tr> 
                    </table> 
                </td> 
            </tr> 
        </table>   
    </body>
</html>