Closed kevin70 closed 3 hours ago
Save users data and save wechat_profile
users
wechat_profile
Only save users data
@Getter @Setter @Entity @Table(name = "users") public class User { /// 主键 @Id @GeneratedValue private Long id; /// 创建时间 @WhenCreated private Instant createTime; /// 更新时间 @WhenModified private Instant updateTime; /// 软删除 @SoftDelete private Boolean deleted; /// 头像地址 private String avatar; /// 昵称 private String nickname; /// 手机 private String mobile; /// 微信个人信息 @OneToOne(cascade = CascadeType.ALL) @PrimaryKeyJoinColumn private WechatProfile wechatProfile; } @Getter @Setter @Entity @Table(name = "wechat_profile") public class WechatProfile { /// 主键 @Id private Long id; /// 创建时间 @WhenCreated private Instant createTime; /// 更新时间 @WhenModified private Instant updateTime; }
12-02T18:35:45.344 D [Test worker] io.ebean.SQL 128; txn[1001] insert into users (avatar, nickname, mobile, create_time, update_time, deleted) values (?,?,?,?,?,?); -- bind(ZHLWOYEE,JAZRS,VQLQETHDUI,2024-12-02T10:35:43.604Z,2024-12-02T10:35:43.604Z,false) 12-02T18:35:45.357 D [Test worker] io.ebean.SUM 128; txn[1001] Inserted [User] [20] 12-02T18:35:47.133 D [Test worker] io.ebean.TXN 128; txn[1001] Commit
Sorry, it's my fault. Using standard JPA mapping can correctly cascade and save.
Expected behavior
Save
users
data and savewechat_profile
Actual behavior
Only save
users
dataSteps to reproduce