Jackson has added @JsonManagedReference, @JsonBackReference, & @JsonIdentityInfo to support putting JPA Entities directly to the wire.
Similar annotations in JSON-B would be useful for getting rid of entity-object-to-value-object and value-object-to-entity-object transformers as an unnecessary layer of code.
What I think I'd like is something akin to @JsonbSerializeAsSingleField("person.personId"), as in:
@ManyToOne
@JoinColumn(name = "person_id")
@JsonbSerializeAsSingleField("person.personId")
public Person person;
But I suspect what I want is slightly more involved than this, and might require JSON deserialization to know more about JPA entities and entity manager, since IDs should become managed references on deserialization.
Jackson has added
@JsonManagedReference,@JsonBackReference, &@JsonIdentityInfoto support putting JPA Entities directly to the wire.Similar annotations in JSON-B would be useful for getting rid of entity-object-to-value-object and value-object-to-entity-object transformers as an unnecessary layer of code.
What I think I'd like is something akin to
@JsonbSerializeAsSingleField("person.personId"), as in:But I suspect what I want is slightly more involved than this, and might require JSON deserialization to know more about JPA entities and entity manager, since IDs should become managed references on deserialization.