spring-projects / spring-projects/spring-data-relational
Make sure referenced immutable Entities get updated in collections even if the immutable parent doesn't have an explicit id [DATAJDBC-433]
オープン
@schauder がすでに取り組んでいます。
2020年12月31日 から。
type: bug
- 主要言語
- Java
- スター
- 827
- フォーク
- 394
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Jens Schauder opened DATAJDBC-433 and commented
If an entity A contains a collection List<C> with A and C both being immutable, A needs to get updated even though it might not have an id if C has or any of the classes it references directly or indirectly.
This was ensured by DATAJDBC-291 by the test below but it is not entirely sure it is still handled properly by the variant about to get merged.
@Test
public void updatingCollectionInEntityWithoutId() {
CollectionOwner owner = new CollectionOwner(null, "owner", singletonList(new IdLessIntermediate("intermediate", singletonList(new Element(null, "Lovecraft")))));
CollectionOwner saved = template.save(owner);
Long id = saved.id;
assertThat(id).isNotNull();
Element savedLovecraft = saved.list.get(0).list.get(0);
assertThat(savedLovecraft.id).isNotNull();
CollectionOwner changedOwner = new CollectionOwner(id, "owner", singletonList(new IdLessIntermediate("intermediate", asList(savedLovecraft, new Element(null, "Sakurai")))));
CollectionOwner savedAgain = template.save(changedOwner);
SoftAssertions softly = new SoftAssertions();
softly.assertThat(savedAgain.id).isEqualTo(id);
softly.assertThat(savedAgain.list.get(0).list.get(0)).isEqualTo(savedLovecraft);
softly.assertThat(savedAgain.list.get(0).list.get(1).id).describedAs("Element has id set and that element is part of the aggregate").isNotNull();
softly.assertAll();
}
Issue Links:
- DATAJDBC-291 Nested data structure with Spring Data JDBC
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。