问题描述
我想问一下关于Spring data benchbase 2.x
I want to ask about spring data couchbase 2.x
我可以在Spring数据沙发基础上引用文档,例如Spring数据mongodb中的@DbRef
注释吗?
Can I refer a document in spring data couchbase like @DbRef
annotation in spring data mongodb?
推荐答案
https://jira.spring.io/plugins/servlet/mobile#issue/DATAREST-326
Spring Data有一个@Reference,它确实是由元数据评估的,而@DBRef则将其用于mongodb.
Spring Data has an @Reference which indeed is evaluated by the metadata and @DBRef carries it for mongodb.
示例:
Author.java
Author.java
@Document
public class Author {
@Field
private String name;
}
Book.java
Book.java
@Document
public class Book {
@Field
private String title;
@Reference
private Author author;
}
使用simpledb https://github.com/3pillarlabs/spring-data的@Reference
的示例代码-simpledb#reference
Sample code for @Reference
using simpledb https://github.com/3pillarlabs/spring-data-simpledb#reference
这篇关于Spring Data Couchbase(2.x)文档关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!