簡體   English   中英

不成功:使用休眠模式創建表

[英]Unsuccessful: create table using 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

這是我的hibernate.cfg文件

<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"/>

如堆棧跟蹤所示,Hibernate從MySQL數據庫捕獲了一個異常,因此請嘗試直接在數據庫中執行查詢(直接調試比通過框架調試要容易得多)。

如果將表名稱中的點更改為下划線,則查詢將成功執行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM