如果我为 transient 变量提供列标记,在 hibernate 中会发生什么?
@Table(name="team")
public class Team extends BaseObject implements Serializable {
@Id @GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
@Column(length=50)
private String name;
@Column(length=10)
private String code;
@Column(name = "agency_id")
private Long agencyId;
@Column(name = "agency_name")
private transient String agencyName;
}
最佳答案
字段不是持久的。您不会从数据库获取字段值,更改也不会被提交。
If the entity has field-based access, the persistence provider runtime accesses instance variables directly. All non-transient instance variables that are not annotated with the Transient annotation are persistent.
关于java - 如果我为 transient 变量提供列标记,在 hibernate 中会发生什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26288327/