这些是我正在使用的框架:spring MVC 3.2.3、Roo 1.2.4 和 ava 1.7。
我已将 Transient 字段添加到 Item 域,如下所示:
@Transient
private Long hierarchyNbr;
保存实体
entityRepository.saveAndFlush(obj)
我遇到以下异常:
Hibernate: insert into dbo.Item (CreateTs, CreateUser, Descr, ForAnyCompanyInd, hierarchyNbr, IdIndustry, IdUom, IsClassifiedInd, IsParentInd, LastUpdateTs, LastUpdateUser) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2014-07-25 10:48:09,580 [http-bio-8080-exec-9] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Invalid column name 'hierarchyNbr'.
根据我的理解,hierarchyNbr字段应该NOT被持久化,不是吗?
那么,有人可以帮我解决这个案子吗?
最佳答案
您需要使用javax.persistence.Transient
。
您正在使用this transient 注释不正确。
关于hibernate - Spring Roo @Transient 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24959858/