Equivalent to @JsonIdentityInfo for XML object to overcome infinite recursive loop on Spring MVC -


my data model object support both xml , json. able json (accept: application/json) object xml (accept: application/xml) getting below exception: example: [com.sun.istack.internal.saxexception2: cycle detected in object graph. cause infinitely deep xml: ....

i have fixed recursive loop json fixed using @jsonidentityinfo. how fix xml. ? data model classes are:

enterprise class:

@entity @table(name = "enterprise") @xmlaccessortype(xmlaccesstype.field) @xmlrootelement @jsonidentityinfo(generator = objectidgenerators.propertygenerator.class,  property = "enterpriseid", scope = enterprise.class) public class enterprise extends baseentity implements serializable { //setters , getter properties } 

organization class:

@entity @table(name = "organization") @xmlaccessortype(xmlaccesstype.field) @xmlrootelement @jsonidentityinfo(generator = objectidgenerators.propertygenerator.class,  property = "organizationid", scope = organization.class) public class organization extends baseentity implements serializable { //setters , getter properties } 

can please me resolve ? thanks.

after trying lot, found solution. solved issue below:

import org.eclipse.persistence.oxm.annotations.xmlinversereference; public class organization extends baseentity implements serializable { .... @xmlinversereference(mappedby = "organizations")  private enterprise enterprise; ... } 

thanks :)


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -