具體回答你的問題,你可以在Address
使用@Field("line1")
爲street
。
我已經在我的項目是這樣的,它工作正常(見descriptions
)
1級
@Document
@JsonInclude(JsonInclude.Include.NON_NULL)
public class HotelInfo {
@Field("hotel_type") @JsonProperty("hotel_type")
public String hotelType;
@Field @JsonProperty("images")
public List<Image> images = new ArrayList<Image>();
@Field @JsonProperty("regions")
public List<String> regions = new ArrayList<String>();
@Field @JsonProperty("themes")
public List<String> themes = new ArrayList<String>();
@Field @JsonProperty("facilities")
public List<String> facilities;
@Field @JsonProperty("descriptions")
public Descriptions descriptions;
}
2級
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Descriptions {
@Field("hotel_information") @JsonProperty("hotel_information")
public String hotelInformation;
}
你試過@Field(NAME =」 line1「) – Koitoer
不,因爲我想知道重命名支持有多遠。我可以在查詢中使用重命名的字段嗎? –
我不認爲我在開發過程中測試了這個用例,所以我不會把它作爲答案,但它應該與內部類中字段的註釋一起工作,並且派生查詢應該使用Java名稱並獲取轉換爲N1QL中的別名 –