Community
Participate
Working Groups
Structure of XML and JSON entities are inconsistent. When an entity has no relationships the generated XML does not include an empty element while an empty array is generated in JSON. An entity with no relationships should not generate a "_relationships" attribute. <employee> <addressId>0</addressId> <firstName>Shaun</firstName> <id>3</id> <lastName>Smith</lastName> </employee> { "addressId": 0, "firstName": "Shaun", "id": 3, "lastName": "Smith", "_relationships": [] }
Are you referring to an entity that has no relationship mappings, or an entity that has relationships mappings but they are all empty?
I mean an Entity with no relationship mappings. E.g. the following class with mappings in orm.xml: public class Employee implements Serializable { private static final long serialVersionUID = -4158718142583269181L; private int id; private String firstName; private String lastName; private int addressId; will produce the JSON and XML in the first comment. The "_relationships" property is out of place given there are no relationships mapped. And XML is ok.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink