JPA Transient Annotation and JSON

后端 未结 10 1400
无人共我
无人共我 2020-11-29 03:03

This is a follow up to the following question on the JPA Transient annotation Why does JPA have a @Transient annotation?

I have a transient variable that I do not wa

相关标签:
10条回答
  • 2020-11-29 03:26

    Since no other solution here worked for me, let me post my solution how it did the trick for me:

    @Transient
    @JsonSerialize
    private String mapImageSrc;
    

    This seems to be the best solution to me as the @JsonSerialize annotation has been made for that use case.

    0 讨论(0)
  • 2020-11-29 03:32

    Try @JsonView after adding @Transient

    0 讨论(0)
  • 2020-11-29 03:35

    use @JsonIgnore in com.fasterxml.jackson.annotation there also is @JsonFormat for Date variable. works for me

    0 讨论(0)
  • 2020-11-29 03:39

    I use both @Transient and @JsonProperty, then it works!

    @Transient
    @JsonProperty
    private String mapImageSrc;
    
    0 讨论(0)
提交回复
热议问题