<!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/0c15daee1256fcb716bd5d8344063042?s=48&amp;d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F0c15daee1256fcb716bd5d8344063042%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="lyor" id="email_lyor" href="https://hibernate.atlassian.net/secure/ViewProfile.jspa?name=lyor" style="color:#6c797f;; color: #3b73af; text-decoration: none">Lyor Goldstein</a> <strong>commented</strong> on <a href="https://hibernate.atlassian.net/browse/HHH-12641" style="color: #3b73af; text-decoration: none"><img src="cid:jira-generated-image-avatar-e44e3250-9db7-45ab-b24d-f3e1c732d1de" height="16" width="16" border="0" align="absmiddle" alt="Bug"> HHH-12641</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-12641" style="color: #3b73af; text-decoration: none">Re: Joined table values not persisted when using JOINED JPA inheritance after upgrade beyond 5.2.12</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 turned on</p> 
                                                        <div class="preformatted 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="preformattedHeader panelHeader" style="border-bottom-width: 1px;; border-bottom: 1px solid #cccccc; padding: 9px 12px">
                                                                <b>log4j.properties</b>
                                                            </div>
                                                            <div class="preformattedContent panelContent" style="padding: 9px 12px"> 
                                                                <pre style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal; white-space: pre; word-break: normal; word-wrap: break-word; word-break: break-all; white-space: pre-wrap"># Hibernate logging
log4j.logger.org.hibernate.SQL=DEBUG
log4j.logger.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
</pre> 
                                                            </div>
                                                        </div> <p style="margin: 10px 0 0">and I don't know if this matters, but I did notice some difference in the generated SQL queries between the test code and the production one:</p> 
                                                        <div class="preformatted 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="preformattedHeader panelHeader" style="border-bottom-width: 1px;; border-bottom: 1px solid #cccccc; padding: 9px 12px">
                                                                <b>Test code log output</b>
                                                            </div>
                                                            <div class="preformattedContent panelContent" style="padding: 9px 12px"> 
                                                                <pre style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal; white-space: pre; word-break: normal; word-wrap: break-word; word-break: break-all; white-space: pre-wrap">2018-07-23 15:25:20 INFO  LogHelper:31 - HHH000204: Processing PersistenceUnitInfo [
        name: templatePU
        ...]
2018-07-23 15:25:20 INFO  Version:45 - HHH000412: Hibernate Core {5.2.17.Final}
2018-07-23 15:25:20 INFO  Environment:198 - HHH000205: Loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=org.h2.Driver, javax.persistence.validation.mode=NONE, hibernate.service.allow_crawling=false, hibernate.max_fetch_depth=5, hibernate.dialect=org.hibernate.dialect.H2Dialect, hibernate.format_sql=true, hibernate.cache.region.factory_class=org.hibernate.testing.cache.CachingRegionFactory, hibernate.connection.username=sa, hibernate.cache.region_prefix=hibernate.test, hibernate.connection.url=jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1, hibernate.bytecode.use_reflection_optimizer=false, hibernate.show_sql=false, hibernate.physical_naming_strategy=org.hibernate.bugs.hhh12641.ImprovedPhysicalNamingStrategyImpl, hibernate.session.events.log=true, hibernate.jdbc.batch_versioned_data=true, hibernate.connection.pool_size=5}
2018-07-23 15:25:20 WARN  CachingRegionFactory:52 - CachingRegionFactory should be only used for testing.
2018-07-23 15:25:20 INFO  Version:66 - HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2018-07-23 15:25:20 WARN  pooling:73 - HHH10001002: Using Hibernate built-in connection pool (not for production use!)
2018-07-23 15:25:20 INFO  pooling:129 - HHH10001005: using driver [org.postgresql.Driver] at URL [jdbc:postgresql://localhost:5432/c_application_rweb?binaryTransferDisable=TIMESTAMP]
2018-07-23 15:25:20 INFO  pooling:138 - HHH10001001: Connection properties: {user=c_application_rweb, password=****}
2018-07-23 15:25:20 INFO  pooling:143 - HHH10001003: Autocommit mode: false
2018-07-23 15:25:20 INFO  DriverManagerConnectionProviderImpl:281 - HHH000115: Hibernate connection pool size: 5 (min=1)
2018-07-23 15:25:20 INFO  Dialect:157 - HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL95Dialect
2018-07-23 15:25:20 INFO  LobCreatorBuilderImpl:124 - HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
2018-07-23 15:25:20 INFO  BasicTypeRegistry:148 - HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType@1162410a
2018-07-23 15:25:21 WARN  AnnotationBinder:872 - HHH000457: Joined inheritance hierarchy [org.hibernate.bugs.hhh12641.DataSourceResource] defined explicit @DiscriminatorColumn.  Legacy Hibernate behavior was to ignore the @DiscriminatorColumn.  However, as part of issue HHH-6911 we now apply the explicit @DiscriminatorColumn.  If you would prefer the legacy behavior, enable the `hibernate.discriminator.ignore_explicit_for_joined` setting (hibernate.discriminator.ignore_explicit_for_joined=true)
2018-07-23 15:25:21 INFO  access:47 - HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@3b4d50b] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.
2018-07-23 15:25:21 DEBUG SQL:92 - 
    insert 
    into
        data_source_resources
        (host, password, path, port, protocol, username, created_date, discriminator) 
    values
        (?, ?, ?, ?, ?, ?, ?, 'DATA_BASE')
Hibernate: 
    insert 
    into
        data_source_resources
        (host, password, path, port, protocol, username, created_date, discriminator) 
    values
        (?, ?, ?, ?, ?, ?, ?, 'DATA_BASE')
2018-07-23 15:25:21 TRACE BasicBinder:65 - binding parameter [1] as [VARCHAR] - [localhost]
2018-07-23 15:25:21 TRACE BasicBinder:53 - binding parameter [2] as [VARCHAR] - [null]
2018-07-23 15:25:21 TRACE BasicBinder:65 - binding parameter [3] as [VARCHAR] - [org/hibernate/bugs/hhh12641]
2018-07-23 15:25:21 TRACE BasicBinder:65 - binding parameter [4] as [INTEGER] - [0]
2018-07-23 15:25:21 TRACE BasicBinder:65 - binding parameter [5] as [VARCHAR] - [DataBaseSourceResource]
2018-07-23 15:25:21 TRACE BasicBinder:53 - binding parameter [6] as [VARCHAR] - [null]
2018-07-23 15:25:21 TRACE BasicBinder:65 - binding parameter [7] as [TIMESTAMP] - [Mon Jul 23 15:25:21 IDT 2018]
2018-07-23 15:25:22 DEBUG SQL:92 - 
    insert 
    into
        data_base_settings
        (db_name, db_type, maintenance_db, query, table_name, id) 
    values
        (?, ?, ?, ?, ?, ?)
Hibernate: 
    insert 
    into
        data_base_settings
        (db_name, db_type, maintenance_db, query, table_name, id) 
    values
        (?, ?, ?, ?, ?, ?)
2018-07-23 15:25:22 TRACE BasicBinder:65 - binding parameter [1] as [VARCHAR] - [DB-Mon Jul 23 15:25:21 IDT 2018]
2018-07-23 15:25:22 TRACE BasicBinder:65 - binding parameter [2] as [VARCHAR] - [MSSQL]
2018-07-23 15:25:22 TRACE BasicBinder:53 - binding parameter [3] as [VARCHAR] - [null]
2018-07-23 15:25:22 TRACE BasicBinder:65 - binding parameter [4] as [VARCHAR] - [SELECT COUNT(*) FROM DB-Mon Jul 23 15:25:21 IDT 2018]
2018-07-23 15:25:22 TRACE BasicBinder:53 - binding parameter [5] as [VARCHAR] - [null]
2018-07-23 15:25:22 TRACE BasicBinder:65 - binding parameter [6] as [BIGINT] - [4]
2018-07-23 15:25:22 INFO  StatisticalLoggingSessionEventListener:258 - Session Metrics {
    25588 nanoseconds spent acquiring 1 JDBC connections;
    22501 nanoseconds spent releasing 1 JDBC connections;
    471461 nanoseconds spent preparing 2 JDBC statements;
    2742434 nanoseconds spent executing 2 JDBC statements;
    0 nanoseconds spent executing 0 JDBC batches;
    0 nanoseconds spent performing 0 L2C puts;
    0 nanoseconds spent performing 0 L2C hits;
    0 nanoseconds spent performing 0 L2C misses;
    5898742 nanoseconds spent executing 1 flushes (flushing a total of 1 entities and 0 collections);
    0 nanoseconds spent executing 0 partial-flushes (flushing a total of 0 entities and 0 collections)
}
2018-07-23 15:25:22 INFO  pooling:233 - HHH10001008: Cleaning up connection pool [jdbc:postgresql://localhost:5432/c_application_rweb?binaryTransferDisable=TIMESTAMP]
</pre> 
                                                            </div>
                                                        </div> <p style="margin: 10px 0 0">Note that on the 2nd <tt>INSERT</tt> command the provided ID value is 4 (as it should be) but there is no previous </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-sql" style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal"><span class="code-keyword" style="color: #000091">SELECT</span> currval(...)</pre> 
                                                            </div>
                                                        </div> <p style="margin: 10px 0 0"> as shown in the production log (see one of the previous comments in the issue). So where did the <em>4</em> value come from ? How did the code know that the assigned value for the base entity was <em>4</em> and thus use it to insert the joined part ?</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-12641?inbox=true&focusedCommentId=103237&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-103237",
    "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-12641#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-9d1cb89f-e055-425e-afd9-f10fd2f1bbdf" 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-12641#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">(v1001.0.0-SNAPSHOT#100090-<span title="16977f048cb7400ce1c8661c475e72ba9373f49e" data-commit-id="16977f048cb7400ce1c8661c475e72ba9373f49e}">sha1:16977f0</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; opacity: 0.150"> <img id="footer-pattern-logo-desktop" src="cid:jira-generated-image-static-footer-desktop-logo-ce5e9143-b7f6-41c4-b9fc-f521c7d14581" alt="Atlassian logo" title="Atlassian logo" width="192" height="24" class="image_fix"> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                            </tbody>
                        </table> </td> 
                </tr> 
            </tbody>
        </table>   
    </body>
</html>