Summary:
Executed sql appears to be invalid for Mysql.
Hibernate version:
3.1
Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="events.Event" table="EVENTS">
<id name="id" column="EVENT_ID">
<generator class="increment"/>
</id>
<property name="date" type="timestamp" column="EVENT_DATE"/>
<property name="title"/>
<set name="participants" table="PERSON_EVENT" inverse="true">
<key column="EVENT_ID"/>
<many-to-many column="PERSON_ID" class="events.Person"/>
</set>
</class>
</hibernate-mapping>
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!--For Hibernate's configuration, we can use a simple hibernate.properties file,
a slightly more sophisticated hibernate.cfg.xml file, or even complete
programmatic setup. Most users prefer the XML configuration file:
Copy this file into the source directory,
so it will end up in the root of the classpath.
Hibernate automatically looks for a file called hibernate.cfg.xml
in the root of the classpath, on startup.
-->
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql:///test</property>
<property name="connection.username">belfers</property>
<property name="connection.password"></property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.HSQLDialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>
<mapping resource="com/examples/hibernate/Event.hbm.xml"/>
<mapping resource="com/examples/hibernate/Person.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Code between sessionFactory.openSession() and session.close():N/A
Full stack trace of any exception that occurs:Code:
[java] 14:02:58,462 DEBUG SchemaExport:301 - drop table PERSON_EMAIL_ADDR if exists
[java] 14:02:58,462 DEBUG SchemaExport:286 - Unsuccessful: drop table PERSON_EMAIL_ADDR if exists
[java] 14:02:58,472 DEBUG SchemaExport:287 - 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 'if exists' at line 1
Name and version of the database you are using:Mysql 4.1 and tried 5.0
The generated SQL (show_sql=true):Code:
drop table EVENTS if exists
Should be
Quote:
drop table if exists EVENTS
Debug level Hibernate log excerpt:Code:
[java] 14:02:58,442 DEBUG SchemaExport:301 - drop table EVENTS if exists
[java] 14:02:58,452 DEBUG SchemaExport:286 - Unsuccessful: drop table EVENTS if exists
[java] 14:02:58,452 DEBUG SchemaExport:287 - 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 'if exists' at line 1
[java] 14:02:58,452 DEBUG SchemaExport:301 - drop table PERSON if exists
[java] 14:02:58,462 DEBUG SchemaExport:286 - Unsuccessful: drop table PERSON if exists
[java] 14:02:58,462 DEBUG SchemaExport:287 - 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 'if exists' at line 1
[java] 14:02:58,462 DEBUG SchemaExport:301 - drop table PERSON_EMAIL_ADDR if exists
[java] 14:02:58,462 DEBUG SchemaExport:286 - Unsuccessful: drop table PERSON_EMAIL_ADDR if exists
[java] 14:02:58,472 DEBUG SchemaExport:287 - 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 'if exists' at line 1
[java] 14:02:58,482 DEBUG SchemaExport:301 - drop table PERSON_EVENT if exists
[java] 14:02:58,482 DEBUG SchemaExport:286 - Unsuccessful: drop table PERSON_EVENT if exists
[java] 14:02:58,482 DEBUG SchemaExport:287 - 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 'if exists' at line 1
[java] 14:02:58,482 DEBUG SchemaExport:301 - create table EVENTS (EVENT_ID bigint generated by default as identity (start with 1), EVENT_DATE timestamp, title varchar(255), primary key (EVENT_ID))
[java] 14:02:58,502 ERROR SchemaExport:272 - Unsuccessful: create table EVENTS (EVENT_ID bigint generated by default as identity (start with 1), EVENT_DATE timestamp, title varchar(255), primary key (EVENT_ID))
[java] 14:02:58,512 ERROR SchemaExport:273 - 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 'generated by default as identity (start with 1), EVENT_DATE timestamp, title var' at line 1