@Entity
public class Sinav{
@Column(name="sinav_adi",nullable=false)
private String sinavAdi;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name="ogretmen_id")
private Kullanici ogretmenId;
}//Class Sınav
第2类:
@Entity
public class Kullanici{
@Column(name="tc_no")
private String tcNo;
@OneToMany(cascade = CascadeType.ALL,fetch = FetchType.EAGER,mappedBy = "role")
private Set<KullaniciToRole> kullaniciToRole;
}//Class Kullanici
第3类:
@Entity
public class KullaniciToRole {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="ktr_id")
private long ktrId;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name="kullanici_id")
private Kullanici kullanici;
}//Class KullaniciToRole
第4类:
@Entity
public class Role {
@ManyToMany(cascade = CascadeType.ALL,mappedBy = "kullanici",fetch =FetchType.EAGER)
private Set<KullaniciToRole> kullanicilar;
}//Class-Role
响应输出错误:
{
"sinavAdi": "Mobil Android Uygulama",
"ogretmenId":
{
"tcNo": "45689782154",
"kullaniciToRole":[{"ktrId":1,"kullanici":
}
}
我对休眠中的类进行了映射。我使用了关系数据库设计。 使用restfull jackson软件包完成此操作后,Web服务就会出现问题输出。您遇到“设置”问题。
我看到的最新JSON输出不完整,并且输出不正确,错误在哪里我该怎么办