An infinite loop solves the problem when the entity class bidirectional mapping is JSON serialized

Source: Internet
Author: User

[Email protected]

The specified field is not serialized, and the Exampaper directory field is not serialized as follows

@OneToMany (Mappedby = "Directory",  fetch = fetchtype.lazy) @JsonIgnoreProperties ("directory") Private List<exampaper> exampapers;

[Email protected]

Annotated fields are not serialized

[email protected] and @jsonbackreference

When serializing, attributes that are @JsonBackReference labels are ignored. Attributes that are @JsonManagedReference labeled are serialized.

When serializing, the function of the @JsonBackReference is equivalent to @jsonignore, at which time there can be no @jsonmanagedreference.

When deserializing, if there is no @jsonmanagedreference, the attributes of the @jsonbackreference dimension (the ignored parent or child) are not automatically injected; Automatically injects the attributes of the @jsonbackreference callout.

[Email protected]

Each time the annotated entity class is serialized, Jackson is generated an identity ID for it, and if an object with the same ID (that is, the same object) is encountered, it is not serialized again, ignored directly, and can be severed from the circular reference

An infinite loop solves the problem when the entity class bidirectional mapping is JSON serialized

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.