hibernate中如何用Annotion注解设置model中的字段不持久化

public final static  int DELETESTATUS_YES=1;
    public final static  int DELETESTATUS_NO=0;
    @Id
    @GeneratedValue(
            strategy = GenerationType.IDENTITY
    )
    private Integer id;
    @Column(name = "name")
    private String name;
    @Column(name = "type")
    private String type;
    @Column(name = "querytype")
    private int querytype;//0用户创建,管理员创建
    @Column(name = "config")
    private String config;
    private String host;
    private int port;
    @Column(name = "user_name")
    private String userName;
    @Column(name = "password")
    private String password;
    @Column(name = "zk_dir")
    private String zkDir;
    @Column(name = "creater")
    private String creater;
    @Column(name = "modifier")
    private String modifier;
    @Column(name = "gmt_created")
    private Date gmtCreated;
    @Column(name = "gmt_modified")
    private Date gmtModified;
    @Column(name = "delete_status")
    private int deleteStatus;
    @Column(name = "database_name")
    private String databaseName;
    @Column(name = "region")
    private String region;
    @Transient
    private String table;

table字段加入@Transient注解就可以了

展开阅读全文

没有更多推荐了,返回首页