我正在尝试在一个级别而不是多个级别上打印实体的参数
我尝试了DTO解决方案。它可以工作,但是我正在寻找注释来帮助我。
实体类
@Entity
public class MyClass implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
private MyClassPK id;
@Column(name="Ordr_No")
private BigDecimal ordrNo;
@Column(name="Desc")
private String desc;
....
}
Id类
@Embeddable
public class MyClassPK implements Serializable {
//default serial version id, required for serializable classes.
private static final long serialVersionUID = 1L;
@Column(name="Name")
private String name;
@Column(name="Location")
private String location;
...
}
Json Response是
{
"id": {
"name": "value",
"locatoin": "value"
},
"ordrNo": 3,
"desc": "value"
}
我想要它
{
"name": "value",
"locatoin": "value",
"ordrNo": 3,
"desc": "value"
}