Error using Hibernate with H2 in memory database

前端 未结 1 420
清酒与你
清酒与你 2020-12-31 04:00

I\'m working with Hibernate. How can I configure my persistence.xml to have an H2 in-memory database?

My persistence.xml is:



        
1条回答
  •  情歌与酒
    2020-12-31 04:35

    You should set hibernate.hbm2ddl.auto property to "create" the first time you run your application, to create the tables

    
    

    and then (if you don't want the tables to be recreated and emptied every time you start) set it to "validate".

    
    

    To create the schema automatically, add if-not-exists to your connection url like this:

    
    

    0 讨论(0)
提交回复
热议问题