java - 这些 Hibernate 对象有何不同?

标签 java hibernate hibernateexception

<分区>

Possible Duplicate:
Hibernate: different object with the same identifier value was already associated with the session

为什么我在Hibernate异常中得到的一些对象,打印出来时带有@符号,会出现这样的情况:

无法删除对象

db.item.model.Inventory@21d321bb

但有些看起来像这样:

org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [db.item.model.Inventory#9369629]

在#符号后有标识符?

最佳答案

db.item.model.Inventory@21d321bb 指的是一个内存地址。

db.item.model.Inventory#9369629 指的是 ID 为 9369629 的实体。

关于java - 这些 Hibernate 对象有何不同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6073374/

相关文章:

java - Spring Boot H2 数据库 - 表不显示

java - 仅更新 Google App Engine 上的 HTML 文件

java - 关于结果集类型 JDBC

java - Hibernate 无法使用 Spring Boot 在编译的 jar 中创建entityManagerFactory bean

java - 将 Hibernate、JDBC 和 SpringSecurity 连接在一起时出现问题

java - 在 Clojure+ 中使用 Java jar

java - 为 ORM 域图设计 JPARepository 的最佳实践

hibernate - 提取导致 ConstraintViolationException 的字段名称

java - FUSE hibernate 应用程序抛出 No Session found for current thread 异常

hibernate - 多个数据源导致 HibernateException?