【问题标题】:Spring Roo @Transient not workingSpring Roo @Transient 不工作
【发布时间】:2014-07-25 16:01:06
【问题描述】:

这些是我正在使用的框架:spring MVC 3.2.3、Roo 1.2.4 和 ava 1.7。

我在 Item 域中添加了一个 Transient 字段,如下所示:

@Transient
private Long hierarchyNbr;

在保存实体时

entityRepository.saveAndFlush(obj)

我收到以下异常:

休眠: 插入 进入 dbo.Item (CreateTs、CreateUser、Descr、ForAnyCompanyInd、hierarchyNbr、IdIndustry、IdUom、IsClassifiedInd、IsParentInd、LastUpdateTs、LastUpdateUser) 价值观 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2014-07-25 10:48:09,580 [http-bio-8080-exec-9] 错误 org.hibernate.engine.jdbc.spi.SqlExceptionHelper - 列名“hierarchyNbr”无效。

根据我的理解 hierarchyNbr 字段应该被持久化,不是吗?

那么,有人可以帮我处理这个案子吗?

【问题讨论】:

  • @Transient 使用的导入是什么?
  • 我的域对象中需要一个不会被持久化的字段,而这不在表格中。
  • 对不起这里是:org.springframework.data.annotation.Transient

标签: hibernate spring-mvc jpa spring-roo spring-data-jpa


【解决方案1】:

您需要使用javax.persistence.Transient

您正在使用不正确的this 瞬态注释。

【讨论】:

    【解决方案2】:

    您应该使用 javax.persistence.Transient 注解。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-05
      • 1970-01-01
      • 2016-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-24
      • 1970-01-01
      相关资源
      最近更新 更多