我正在使用Spring Boot 2.x,Spring Data REST,Hibernate(5.2 / 5.3)。
我有两个实体:
@Entity
public class PaymentTerm extends AbstractEntity {
@NotBlank
@Column(nullable = false)
private String name;
@NotBlank
@Column(nullable = false, unique = true)
private String code;
@NotNull
@Column(nullable = false, columnDefinition = "BIT DEFAULT 0")
private boolean endOfMonth = false;
@NotNull
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private PaymentType paymentType;
@ElementCollection
private Set<PaymentDue> paymentsDue = new HashSet<>();
和
@Embeddable
public class PaymentDue {
@Min(0)
@NotNull
@Column(nullable = false)
private int days = 0;
@Min(1)
@Max(100)
@NotNull
@Column(nullable = false)
private BigDecimal percentage = new BigDecimal(100);
Hibernate为嵌入式集合生成此主键:
我想更改主键的名称。有可能吗?
我知道有注解@AttributeOverride
,但不能解决我的问题。