Note that there are some explanatory texts on larger screens.

plurals
  1. POhibernate generates wrong sql "select max(id) from my_table"
    primarykey
    data
    text
    <p>i did little app with Hibernate. just from samples available from the HB site.</p> <p>Hibernate says to DB:</p> <pre><code>drop table if exists some_db.my_table create table some_db.my_table ...... select max(id) from my_table </code></pre> <p>when i turn from HSQL db to MySQL.</p> <p>i am having error "DEBUG o.h.e.jdbc.spi.SqlExceptionHelper - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'my_table' at line 1 [n/a]"</p> <p>because HB stubbornly tries to say </p> <pre><code>select max(id) from my_table </code></pre> <p>instead of </p> <pre><code>select max(id) from some_db.my_table </code></pre> <p>which is correct syntax when it comes to </p> <pre><code>public void testBasicUsage() { // create a couple of events... Session session = sessionFactory.openSession(); session.beginTransaction(); session.save( new Event( ..... ) ); // &lt;&lt;-------------------HERE session.save(new Event( ..... )); session.getTransaction().commit(); session.close(); </code></pre> <p>and changing dialect doesn't help.</p> <p>i've tried to switch to different hb versions, for example </p> <pre><code>&lt;dependency&gt; &lt;groupId&gt;org.hibernate&lt;/groupId&gt; &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt; &lt;version&gt;4.1.6.Final&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;mysql&lt;/groupId&gt; &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt; &lt;version&gt;5.1.21&lt;/version&gt; &lt;/dependency&gt; </code></pre> <p>but it doesn't help, too.</p> <p>changing connection (standard "root"/"" access) like </p> <pre><code>jdbc:mysql://localhost:3306/some_db </code></pre> <p>instead of </p> <pre><code>jdbc:mysql://localhost:3306 </code></pre> <p>doesn't help either.</p> <p>it seems to be a bug, but what would be a solution?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload