JPA按实体类对象参数中的字段排序问题得解决方法
@Entity @Table(name="complaints") @NamedEntityGraphs({ @NamedEntityGraph(name="allJoinsButMessages", attributeNodes = { @NamedAttributeNode("customer"), @NamedAttributeNode("handling_employee"), @NamedAttributeNode("genre") }), @NamedEntityGraph(name="allJoins", attributeNodes = { @NamedAttributeNode("customer"), @NamedAttributeNode("handling_employee"), @NamedAttributeNode("genre"), @NamedAttributeNode("complaintMessages") }), @NamedEntityGraph(name="noJoins", attributeNodes = { }) }) public class Complaint implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue private long id; private Timestamp date; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "customer") private User customer; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "handling_employee") private User handling_employee; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name="genre") private Genre genre; private boolean closed; @OneToMany(mappedBy = "complaint", fetch = FetchType.LAZY, cascade = CascadeType.ALL) private List<ComplaintMessage> complaintMessages = new ArrayList<ComplaintMessage>(); //getters and setters
版权声明:本文为chenshuquan原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/chenshuquan/p/9604023.html