Failed: create a table using sleep mode

I get this error when I want to create a new table in hibernate

SEVERE: Unsuccessful: create table gmail.messages.test (CODE_PERS varchar(255) not null, LAST_NAME varchar(255), FIRST_NAME varchar(255), primary key (CODE_PERS)) 3.8.2012 18:30: org.hibernate.tool.hbm2ddl.SchemaExport create SEVERE: 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 '.test (CODE_PERS varchar(255) not null, LAST_NAME varchar(255), FIRST_NAME varch' at line 1 3.8.2012 18:30: org.hibernate.tool.hbm2ddl.SchemaExport execute 

here is my hibernate.cfg file

 <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/gmail.messages</property> <property name="hibernate.connection.username">root</property> <property name="hibernate.connection.password">admin</property> <!-- <property name="hbm2ddl.auto" value="auto"/> --> <property name="hibernate.show_sql">true</property> <property name="transaction.factory_class"> org.hibernate.transaction.JTATransactionFactory </property> <property name="use_outer_join">false</property> <property name="jta.UserTransaction">java:comp/UserTransaction</property> <property name="hibernate.connection.pool_size">12</property> <property name="hibernate.hbm2ddl.auto">create</property> <property name="hibernate.default_schema">gmail.messages</property> <property name="current_session_context_class">thread</property> <mapping resource="HibernateMapping/hibernate.hbm.xml"/> 
+4
source share
1 answer

As shown by the stack trace, Hibernate caught an exception from the MySQL database, so try executing the query directly in the database (it is much easier to debug directly than through the framework).

Your query will succeed if you change the period in the table name to an underscore.

+6
source

All Articles