Heim > Fragen und Antworten > Hauptteil
new: false ?????
我没有这个字段,这个是jpa的创建状态吧,false不是新建对象
怎么删掉?
@Entity
@Table(name = "tb_user")
@DynamicUpdate
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Access(AccessType.FIELD) //强制hibernate全部访问字段注解
@Accessors(chain = true)
public class User extends BaseUUIDEntity implements Serializable {
private static final long serialVersionUID = 1L;
public enum Sex {
@MetaData("男")
MAN, //男
@MetaData("女")
WOMAN //女
}
@Column(name = "user_name", length = 20, nullable = false)
@MetaData("用户名")
private String userName;
@Column(name = "pass_word", length = 32)
@MetaData("密码")
private String passWord;
@Column(length = 12)
@MetaData("手机号")
private String phone;
@Column(name = "head_photo")
@MetaData("头像")
private String headPhoto;
@Enumerated(EnumType.STRING)
@Column(length = 5, columnDefinition = "varchar(5) default 'MAN'")
@MetaData("性别")
private Sex sex;
@Temporal(TemporalType.DATE)
@MetaData("生日")
private Date birthday;
@JSONField(serialize = false)
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
@JoinColumn(name = "merchant_id")
private Merchant merchant;
}
@ResponseBody
return ResponseEntity.ok(new Msg(HttpStatus.OK.value(), Constant.MESSAGE_SUCCESS, user.setPassWord("you don't want to know")));