<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
<br>
<blockquote cite="mid:002401c9fb30$4ba1d9b0$e2e58d10$@com" type="cite">
  <div class="Section1">
  <p class="MsoNormal" style="margin-bottom: 12pt;"><span
 style="color: rgb(31, 73, 125);">&gt;
  </span>No, what should it based the cache on ?<span
 style="color: rgb(31, 73, 125);"><o:p></o:p></span></p>
  <p class="MsoNormal" style="margin-bottom: 12pt;"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, 125);">Firstly
I think just simple
properties: databaseName &amp; databaseMajorVersion be suitable&#8230;</span></p>
  </div>
</blockquote>
But neither of these are available without doing a connection.<br>
<blockquote cite="mid:002401c9fb30$4ba1d9b0$e2e58d10$@com" type="cite">
  <div class="Section1">
  <p class="MsoNormal" style="margin-bottom: 12pt;"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, 125);"><o:p></o:p></span></p>
  <p class="MsoNormal" style="margin-bottom: 12pt;"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, 125);">If
useJdbcMetadata and databaseName
== null &amp; databaseMajorVersion == null<o:p></o:p></span></p>
  <p class="MsoNormal" style="margin-bottom: 12pt;"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, 125);">Then
get connection and
initialize as it is. So it call getConnection only once &#8211; but this is
SettingsFactory
&#8211; not suitable solution&#8230;<o:p></o:p></span></p>
  <p class="MsoNormal" style="margin-bottom: 12pt;"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, 125);">It
seems like a &#8220;if (
useJdbcMetadata ) {&#8221; block &#8211; not a right place in SettingsFactory -&gt;
buildSettings, seems should be parameters for buildSettings function -
databaseName,
databaseMajorVersion. databaseName, databaseMajorVersion &#8211; should be
initialized from other place.</span></p>
  </div>
</blockquote>
Or simply just do the detection outside SF and set the dialect.<br>
<blockquote cite="mid:002401c9fb30$4ba1d9b0$e2e58d10$@com" type="cite">
  <div class="Section1">
  <p class="MsoNormal" style="margin-bottom: 12pt;"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, 125);"><o:p></o:p></span></p>
  <p class="MsoNormal" style="margin-bottom: 12pt;"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, 125);">Just
setAttribute("hibernate.temp.use_jdbc_metadata_defaults",
true) or autoConfigureDialect (better if not a job of hibernate core)
could be
a nice feature,</span></p>
  </div>
</blockquote>
Then only do that when you know the configuration is to be used with
reverse engineering and thrown away again.<br>
The reason I removed it was that for all other usecases of
configuration (code completion and code generation based on
hbm.xml/existing entities) requiring the<br>
database to be connected is bad since the db is not needed and it
causes massive ui freezing.<br>
<blockquote cite="mid:002401c9fb30$4ba1d9b0$e2e58d10$@com" type="cite">
  <div class="Section1">
  <p class="MsoNormal" style="margin-bottom: 12pt;"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, 125);"><o:p></o:p></span></p>
  <p class="MsoNormal" style="margin-bottom: 12pt;"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, 125);">It
prevent user to make one
more configuration step to setup dialect by hands&#8230;<o:p></o:p></span></p>
  <p class="MsoNormal" style="margin-bottom: 12pt;"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, 125);">It&#8217;
a pity if not
possible to use &#8220;hibernate.temp.use_jdbc_metadata_defaults&#8221; or
autoConfigureDialect
&#8230;<o:p></o:p></span></p>
  <p class="MsoNormal" style="margin-bottom: 12pt;"><span
 style="color: rgb(31, 73, 125);">May
be the solution is to get </span><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, 125);">databaseName
&amp; databaseMajorVersion or
in general dialect in independent thread &#8211; only synchronization issue,</span></p>
  </div>
</blockquote>
again, hibernate core should not care about this and it should
definitely not created separate threads.<br>
<br>
Calling hibernate in a seperate thread/job in the tooling might be a
solution though.<br>
<blockquote cite="mid:002401c9fb30$4ba1d9b0$e2e58d10$@com" type="cite">
  <div class="Section1">
  <p class="MsoNormal" style="margin-bottom: 12pt;"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, 125);"><o:p></o:p></span></p>
  <p class="MsoNormal" style="margin-bottom: 12pt;"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, 125);">So
Hibernate Console Config could
display it&#8217;s nodes and in case when the user try to expand &#8220;Database&#8221;
(here is a try to connect to db in any case) - db dialect could get its
value. But
in case if db dialect doesn&#8217;t get value &#8211; the user should specify
this by hands&#8230; Look like too much &#8220;could&#8221; and &#8220;but&#8221;,
but this is only specific cases &#8211; in general it seems useful and
possible
to use (autoConfigureDialect in independent thread). In the bad case we
just
get a long running thread.<o:p></o:p></span></p>
  </div>
</blockquote>
There really arent much magic to this - just check if the dialect is
set, if not try and detect it based on jdbc url, driver class name, dtp
connection etc. and only if that fails you will have to ask for it.<br>
Same thing you would have to do when your long running thread
terminates with an error.<br>
<br>
-max<br>
</body>
</html>