我无法插入/更新MaterialEntity
。但我可以findAll()
和findById()
。
有人能支持我吗?
@Entity
@Table(name = "material")
public class MaterialEntity {
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "code")
private String code;
@Column(name = "name")
private String name;
@Column(name = "category_id")
private Integer categoryId;
@Column(name = "unit_id")
private Integer unitId;
@Column(name = "transfer_unit_id")
private Integer transferUnitId;
@Column(name = "barcode_type_id")
private Integer barcodeTypeId;
@Column(name = "quantity")
private Integer quantity;
@Column(name = "description")
private String description;
@OneToMany
@JoinColumn(name="material_id")
private List<MaterialImageEntity> materialImageEntityList;
@CreatedDate
@Column(name = "created_at")
private LocalDateTime createdAt;
@LastModifiedDate
@Column(name = "updated_at")
private LocalDateTime updatedAt;
@Column(name = "deleted_at")
private LocalDateTime deletedAt;
@Column(name = "created_by")
private Integer createdBy;
@Column(name = "updated_by")
private Integer updatedBy;
}
@Entity
@IdClass(MaterialImageCompositePrimaryKeyEntity.class)
@Table(name = "material_image")
public class MaterialImageEntity {
@Id
@Column(name = "material_id", nullable = false)
private Integer materialId;
@Id
@Column(name = "image_id", nullable = false)
private Integer imageId;
@CreatedDate
@Column(name = "created_at")
private LocalDateTime createdAt;
@LastModifiedDate
@Column(name = "updated_at")
private LocalDateTime updatedAt;
}
1条答案
按热度按时间tf7tbtn21#
尝试手动设置内部列表,以及之前的所有字段: