We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I've created the sample repo to demonstrate the problem. Run the following test:
In a nutshell, assume we have an aggregate:
@Table public class Category { @Id private Long id; private String name; @MappedCollection(idColumn = "category_id", keyColumn = "category_id") private List<ProductCategories> productCategories; } @Table public class Product implements Persistable<Long> { @Id private Long id; private String name; @MappedCollection(keyColumn = "product_id", idColumn = "product_id") private List<ProductCategories> productCategories; } @Table public class ProductCategories { private AggregateReference<Product, Long> productId; private AggregateReference<Category, Long> categoryId; }
And when running the following code, the loaded foundProcdut does not contain the ProductCategories:
foundProcdut
ProductCategories
Product product = Product.createNew( 1L, "product first", List.of( new ProductCategories() .setProductId(AggregateReference.to(1L)) .setCategoryId(AggregateReference.to(1L)) ) ); // when. Product saved = productRepository.save(product); // then. Optional<Product> foundProduct = productRepository.findById(saved.getId());
The reason it does not contain ProductCategories is because the INSERT, generated into ProductCategories, has product_id set to 0, instead of 1.
product_id
0
1
Note: It does not even matter is the ID generated on the client side or as an IDENTITY column on the database side. The problem remains.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I've created the sample repo to demonstrate the problem. Run the following test:
In a nutshell, assume we have an aggregate:
And when running the following code, the loaded
foundProcdut
does not contain theProductCategories
:The reason it does not contain
ProductCategories
is because the INSERT, generated intoProductCategories
, hasproduct_id
set to0
, instead of1
.Note: It does not even matter is the ID generated on the client side or as an IDENTITY column on the database side. The problem remains.
The text was updated successfully, but these errors were encountered: