我的实体类看起来像这样:
@Entity
@Table(name = "tbl_programstrm_projstream")
public class ProgramStm_Projstrm_Model {
@Id
@GeneratedValue
private int id;
@Lob
@Column(columnDefinition="TEXT")
private String programstrm;
private int programstrmId;
@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH })
@JoinColumn(name = "projstrmId")//
private ProjectStreamModel projstrmId;
//getter and setter
}
基于这个实体,我得到结果json像这样
{
"programstrm": "D-BSS Implementation",
"programstrmId": 3,
"projstrmId": {
"name": "Program Leadership"
}
}
但我想将ProjectStreamModel响应作为一个字符串而不是一个对象,以便最终结果json看起来像这样“
{
"programstrm": "D-BSS Implementation",
"programstrmId": 3,
"projstrmId": "Program Leadership"
}