无法执行 JDBC 批量更新

发布于 2024-11-14 06:26:01 字数 519 浏览 3 评论 0原文

我对实体类有疑问。当我使用 hibernate.hbm2ddl.auto = create 运行我的应用程序时,它会创建所有其他实体表,但不会创建此实体表。这是为什么?当我自己创建表格并尝试在其中插入一些内容时,我收到此错误: http://pastebin .com/m4gjxqNC

这是我的实体类: 用户实体: http://pastebin.com/YXvzFSgt 评论实体: http://pastebin.com/RpZEUPxN

这是 UserDAO 类 http://pastebin.com/LrTCg0GC

I have a problem with a entity class. When I run my app with hibernate.hbm2ddl.auto = create, then it create all the other entity tables but not this on. Why is that? And when I create the table by myself and after that try to insert something into it, then I get this error: http://pastebin.com/m4gjxqNC

Here's my entity class:
User entity:
http://pastebin.com/YXvzFSgt
Comment entity:
http://pastebin.com/RpZEUPxN

And here's the UserDAO class
http://pastebin.com/LrTCg0GC

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

比忠 2024-11-21 06:26:01

您似乎正在使用 PostgreSQL。根据此文档,“用户”是 PostgreSQL保留字。尝试为您的 User 实体添加 @Table("user_tb") 注释,以强制使用新的表名称。

@Entity
@Table("user_tb")
public class User extends LightEntity implements Serializable {
 //..

}

You seems to be using PostgreSQL. As per this document, 'User' is a PostgreSQL reserved word. Try adding a @Table("user_tb") annotation for your User entity, to force a new table name.

@Entity
@Table("user_tb")
public class User extends LightEntity implements Serializable {
 //..

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文