Hibernate - 无法在postgresql中创建表

时间:2016-01-31 19:53:12

标签: java eclipse hibernate postgresql

我试图在eclipse中使用hibernate框架,以构建一个简单的Web应用程序并将其与PostgreSQL连接。这是我的代码: My Class

The persistence xml file

The test file

这是错误: enter image description here

有谁知道我做错了什么?

2 个答案:

答案 0 :(得分:0)

您应该将属性hibernate.hbmddl.auto值更改为create-dropcreate以强制执行hibernate create schema,因为userclass表不存在。

有关hibernate.hbmddl.auto的更多信息,请访问:https://stackoverflow.com/a/24417561/2055854

答案 1 :(得分:0)

仅适用于可能遇到同样问题的人......

我刚刚找到答案。由于我使用的数据库是postgresql,我不得不在持久性文件中更改属性“hibernate.dialect”。所以,改变后的结果是:

之后,表格就被创建了!

谢谢。

相关问题