簡體   English   中英

無法使用 # MySQL 創建表

[英]unable to create a table using of# MySQL

hibernate 無法創建表為什么...?

<property name="hibernate.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/e_shop</property>
    <property name="hibernate.connection.username">root</property>
    <property name="hibernate.hbm2ddl.auto">create</property>
    <property name="hibernate.show_sql">true</property>

AnnotationConfiguration cfs=new AnnotationConfiguration();
        cfs.configure("daoHibernate/hibernate.cfg.xml");
        new SchemaExport(cfs).create(true,true);

我的所有表都變了,表變了,然后又被創建了為什么如何開始新的會話,請回復

<property name="hibernate.hbm2ddl.auto">create</property>

因此,每次它都會刪除並創建表。

<property name="hibernate.hbm2ddl.auto">update</property> 

使用update而不是create

暫無
暫無

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

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