草庐IT

BookEntity

全部标签

java - 如何与 Spring Data REST 和 JPA 保持双向关系?

使用SpringDataREST,如果您有OneToMany或ManyToOne关系,则PUT操作在“非拥有”实体上返回200,但实际上并不持久加入的资源。示例实体:@Entity(name='author')@ToStringclassAuthorEntityimplementsAuthor{@Id@GeneratedValue(strategy=GenerationType.IDENTITY)LongidStringfullName@ManyToMany(mappedBy='authors')Setbooks}@Entity(name='book')@EqualsAndHashCo

java - 如何与 Spring Data REST 和 JPA 保持双向关系?

使用SpringDataREST,如果您有OneToMany或ManyToOne关系,则PUT操作在“非拥有”实体上返回200,但实际上并不持久加入的资源。示例实体:@Entity(name='author')@ToStringclassAuthorEntityimplementsAuthor{@Id@GeneratedValue(strategy=GenerationType.IDENTITY)LongidStringfullName@ManyToMany(mappedBy='authors')Setbooks}@Entity(name='book')@EqualsAndHashCo