<!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/5fb22020cb431050dcec6c1d20fc77bd?d=mm&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="bvarner" id="email_bvarner" href="https://hibernate.atlassian.net/secure/ViewProfile.jspa?name=bvarner" style="color:#6c797f;; color: #3b73af; text-decoration: none">Bryan Varner</a> <strong>created</strong> an issue </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"> </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 class="page-title-pattern-first-line " style="padding: 0; 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-11424" style="color: #3b73af; text-decoration: none"><img src="cid:jira-generated-image-avatar-beaf5cd7-5388-4513-9852-c44bc24ebb05" height="16" width="16" border="0" align="absmiddle" alt="Bug" style="vertical-align: text-bottom"></a> <a href="https://hibernate.atlassian.net/browse/HHH-11424" style="color: #3b73af; text-decoration: none">HHH-11424</a> </td>
</tr>
<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-11424" style="color: #3b73af; text-decoration: none">hibernate.default_schema Ignored in some cases.</a> </span> </td>
</tr>
</tbody>
</table> </td>
</tr>
<tr>
<td class="email-content-main mobile-expand wrapper-special-margin" 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; padding-top: 10px; padding-bottom: 5px" bgcolor="#ffffff">
<table class="keyvalue-table" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0">
<tbody>
<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: 0; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> <img src="cid:jira-generated-image-avatar-beaf5cd7-5388-4513-9852-c44bc24ebb05" height="16" width="16" border="0" align="absmiddle" alt="Bug" style="vertical-align: text-bottom"> Bug </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: 0; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> 5.1.0, 5.0.9, 5.0.10, 5.2.0, 5.2.1, 5.2.2, 5.1.1, 5.0.11, 5.1.2, 5.2.3, 5.2.4, 5.1.3, 5.2.5, 5.2.6, 5.0.12, 5.1.4, 5.2.7 </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: 0; 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: 0; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> hibernate-core </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: 0; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> 25/Jan/2017 18:01 PM </td>
</tr>
<tr>
<th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">Environment:</th>
<td style="padding: 0; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> EAP 7.0.0.GA (hibernate 5.0.9) <br> SQLServer 2012 through 2016 <br> JTDS 1.3.1 JDBC Driver </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: 0; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> <img src="cid:jira-generated-image-static-major-f05a3bf9-6426-41a4-9d85-b06bbe66d655" 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: 0; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> <a class="user-hover" rel="bvarner" id="email_bvarner" href="https://hibernate.atlassian.net/secure/ViewProfile.jspa?name=bvarner" style="color:#6c797f;; color: #3b73af; text-decoration: none">Bryan Varner</a> </td>
</tr>
</tbody>
</table> </td>
</tr>
<tr>
<td class="email-content-main mobile-expand issue-description-container" 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; padding-top: 5px; padding-bottom: 10px" 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-top:0;margin-bottom:10px;; margin: 10px 0 0; margin-top: 0">Using JPA 2.0 under EAP 6.4 (Hibernate 4.x) everything worked fine.<br> Client has single-tennancy connection provider with a set (non-default by user-name) schema in the database.</p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">This is being set as a config property in persistence.xml as:<br> <tt><property name="hibernate.default_schema" value="foobar"/></tt></p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">Upon attempting to deploy to EAP 7.0.0, hbm2ddl verification fails claiming missing tables.</p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">Initialization shows that static SQL is being generated with the proper schema name prefixed to table names.</p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">After that, when hbm2ddl kicks off, here's the code-path I see happening which I believe is leading to the 'null' schema / catalog names.</p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentImpl.java:255 - The 'determineCurrentSchemaImpl' is being invoked, which is in turn invoking 'resolveSchemaName' on the default schema name resolver (being provided by inheriting all the way up to Dialect itself). The default schemaname resolver is invoking the java1.7 Connection.getSchema() method, however, the driver I'm using doesn't implement it! <img class="emoticon" src="cid:jira-generated-image-static-smile-ed11fc86-524b-484d-83a1-aae0c96da1f2" height="16" width="16" align="absmiddle" alt="" border="0"></p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">This results in SchemaNameResolverJava17Delegate throwing the HibernateException on line 75. (I'm looking at the 5.0.9 code here) regarding it's "Unable to invoke Connection#getSchema method via reflection").</p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">This exception is caught, by the JdbcEnvironmentImpl.java which then returns 'null' for the schema name. (which is not the right thing to do).</p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">In trying to figure out what I'd like to see done here....</p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">1.) I don't think we should be interrogating the current connection state to see what schema is active if there's a default_schema specified in the configuration properties. But I'm also not the hibernate architects, so I'm sure you've got a good reason for doing this.</p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">That said, I've seen several Hibernate apps in the last year (at this client, no less) which use / reference schemas other than the default schema for the connected user. Expecting hbm2ddl to resolve all tables based on the connections 'current schema' would result in inaccurate validate behavior, as it would be trying to validate the tables exist in the <em>current</em> schema, not the one we wanted to be referenced.</p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">2.) I can see how I can easily replace the current schema name resolver based on "hibernate.schema_name_resolver", but why should I have to? This configuration worked properly in 4.x. This will have to be my work-around going forward until something is done about....</p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">3.) In the case of silently catching the Exception on JdbcEnvironmentImpl.java:278, this is really sorta shoddy. Why doesn't it return the value of the default_schema property instead of null? At least then, the verify would be successful and my tables would be properly detected.</p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">To to clarify what I think <em>really</em> ought to be going on inside the DefaultSchemaNameResolver.....</p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">1.) Try JDK 1.7 Connection.getSchema. if it isn't available (or doesn't work when you try it!!)<br> 2.) Fallback to the SchemaNameResolverFallbackDelegate (using Dialect.getCurrentSchemaCommand()). If The Dialect doesn't supply a getCurrentSchemaCommand() then<br> 3.) Return the value of hibernate.default_schema</p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">If all of that gets through and it returns 'null', then you'll have the same behavior I'm currently seeing (where it's not using a schema name) which would seem appropriate.</p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">Perhaps the case could be made that default_schema should be the first thing returned (since you're effectively forcing it) but I think of that more as a 'fallback'.</p> <p style="margin-top:0;margin-bottom:10px;; margin: 10px 0 0">Either way, it's very unsettling to see that the code creating the default static queries for each Entity type is not using the same code paths as the verification code from hbm2ddl.</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-11424?inbox=true&",
"name": "View Issue"
},
"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-11424#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-3655d04e-853c-4cbe-b237-b2741e0446ca" 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-11424#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"> </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.718.1#100026-<span title="45ff2912fc20b90284f300461583dbfb3b0c0ae9" data-commit-id="45ff2912fc20b90284f300461583dbfb3b0c0ae9}">sha1:45ff291</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-b479e045-768c-4baa-b12a-7fa8d91dd81b" 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>