hibernate is not able to create a table why...?
<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);
my all table are getting alter and table getting drop then again created why how to start a new session please give a reply
<property name="hibernate.hbm2ddl.auto">create</property>
because of this, each time it will drop and create tables.
<property name="hibernate.hbm2ddl.auto">update</property>
use update
instead of create
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.