How to create database in Hibernate at runtime?

后端 未结 3 1131
盖世英雄少女心
盖世英雄少女心 2020-12-19 20:42

I\'m using Hibernate tenancy and every time user logs I\'m changing database to his username (SQLite). Sadly sometimes the database does not exists and I need to create it.<

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-19 21:18

    Did you try the value create instead.

    A value of create will create your tables at sessionFactory creation, and leave them intact.

    A value of create-drop will create your tables, and then drop them when you close the sessionFactory.

    That would be

    create
    

    More infornation here and here
    Or there could be a dialect problem

提交回复
热议问题