jackson を使用して oneToMany マッピングでオブジェクトをシリアル化し、文字列形式で応答を返す方法に関するこの知識を共有したいと考えていました。
私のクラス構造:
@Entity
public class Order {
/*
All the fields associated with this class
*/
@OneToMany(fetch = FetchType.EAGER, mappedBy = "orderId")
private Set<OrderDetails> orderDetails;
//Getters for all properties defined in this class as jackson would depend on this thing
}
私の場合、文字列形式のメッセージのみを期待する textWebSocket を使用しているため、オブジェクトをシリアル化してクライアントにプッシュする必要があります。より高速な jackson に依存しています。