我能够将json对象插入到我的实体中,但是遇到一个字段示例serial_id(bigint, default=0)
的问题,如果我不使用值传递字段,则该字段示例在插入时会自动递增1。它应该插入0,但有时并非总是如此
我的Json是一组对象。实体类如下:
public class Sales extends BaseEntity implements Serializable {
@Type(type = “jsonb”)
@Column(columnDefinition = “jsonb”, name = “sales_target”)
private Set<SalesTarget> salesTarget = null;
@column <- mapped to column
private Long serial_id;
}
SalesTarget实体如下:
public class SalesTarget implements Serializable {
private static final long serialVersionUID = 1L;
private String teamLeader;
private int salesVolume;
private Long serialId;
}
服务方法为@transactional
,在调试模式下serialId
为0
,但在DB列中插入1。请帮帮我!