Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 JPA 列,我准备将其标记为 @Transient。但我确实在那个领域有一些数据,我想稍后移动。
我知道@Transient 不会持续存在。但是,我仍然可以将那些现有数据加载到 Java 世界的内存中吗?
No@Transient阻止 JPA/Hibernate 进行任何数据访问操作。
@Transient
但是,如果您有一个只想阅读的字段,则可以将其标记为只读:
@Column(insertable = false, updatable = false) private String transientField;