Force Hibernate To Create Tables After Dropping and Recreating database

前端 未结 2 664
-上瘾入骨i
-上瘾入骨i 2021-01-18 18:03

I am developing a web application with java 2 ee. I also use hibernate and mysql. in order to restore the backup file, in some point in my application i need to drop the cur

2条回答
  •  一整个雨季
    2021-01-18 18:28

    for future googlers : it was so simple after all , i just needed to build session factory so i added this line and it worked like charm :

    new Configuration().configure().buildSessionFactory();

    note that buildSessionFactory() is deprecated in hibernate 4 but i guess you can use the code here to do the same.

提交回复
热议问题