Gui*_*ari 16 annotations hibernate
我有一个包含一些字段的bean,其中两个不打算由hibernate映射(errorStatus和operationResultMessage).如何告诉Hibernate(通过注释)我不想映射这些字段?
*bean中的映射表没有字段:errorStatus和operationResultMessage
提前致谢.
代码右下方:
**得到了Gettters和Setters!
@Entity
@Table(name = "users")
public class AccountBean implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@Column(name = "name")
private String userName;
@Column(name = "email")
private String email;
@Column(name = "login")
private String login;
@Column(name = "password")
private String password;
private Boolean errorStatus;
private String operationResultMessage;
Run Code Online (Sandbox Code Playgroud)
Mat*_*all 37
使用@Transient注释.
/* snip... */
@Transient
private Boolean errorStatus;
@Transient
private String operationResultMessage;
Run Code Online (Sandbox Code Playgroud)
显然,如果你要注释getter/setter而不是字段,那么@Transient注释就会出现.
| 归档时间: |
|
| 查看次数: |
17265 次 |
| 最近记录: |