如何显示特定字段使用ebean关系
how to show specific field use ebean relation
...
是我的代码
@ManyToOne
@JoinColumn(name = "destination_country_id", referencedColumnName = "id", table = "countries", insertable = false, updatable = false)
public Country country;
...
是结果
"id": 139,
"country": {
"id": 1,
"iso": "AU",
"name": "Australia",
},
"country_id": 1
...
希望结果是
"id": 139,
"country": "australia",
"country_id": 1,
...
添加此代码并更改为 private in var country
@Column(name = "name", table = "countries")
public String country_name;
这是我的新代码
@ManyToOne
@JoinColumn(name = "destination_country_id", referencedColumnName = "id", table = "countries", insertable = false, updatable = false)
private Country country;
@Column(name = "name", table = "countries")
public String country_name;
... 是我的代码
@ManyToOne
@JoinColumn(name = "destination_country_id", referencedColumnName = "id", table = "countries", insertable = false, updatable = false)
public Country country;
...
是结果
"id": 139,
"country": {
"id": 1,
"iso": "AU",
"name": "Australia",
},
"country_id": 1
...
希望结果是
"id": 139,
"country": "australia",
"country_id": 1,
...
添加此代码并更改为 private in var country
@Column(name = "name", table = "countries")
public String country_name;
这是我的新代码
@ManyToOne
@JoinColumn(name = "destination_country_id", referencedColumnName = "id", table = "countries", insertable = false, updatable = false)
private Country country;
@Column(name = "name", table = "countries")
public String country_name;