1
我正在評估當前項目的跨商店設計,我們正在考慮使用MySQL和MongoDB。Spring Data的跨存儲持久性是否支持Document-> JPA或Collections?
獨立的,這些產品的Spring支持非常好。但是,跨商店支持似乎是一個更加流血的邊緣。
讀了documentation,我留下了幾個問題:
的doucmentation談到了JPA實體,包含一個持續的@Document
屬性跨店的支持。支持是否以另一種方式存在?也就是說,我可以有一個MongoDB文檔作爲父節點,它包含對JPA實體(或一組實體)的引用?
如:
@Document
public class Product
{
@Entity?
private Manufacturer manufacturer;
@CollectionOfEntities?
private List<Review> reviews
}
類似的,是有持續JPA實體包含Docuemnts集合支持?
如:
@Entity
public class Shop
{
@Id
private Long id;
// Product is a MongoDB @Document
private List<Product> products;
}
,是否支持?
鑑於跨店持久性如此新穎,是否有設計最佳實踐的任何資源或避免的陷阱?