jakartaee / jakartaee/jsonb-api

Annotations to support using JPA Entities for JSON serialization

Open
#358 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
95
Forks
41
Avg merge
1d 6h
Merged PRs (30d)
35

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no repository files, tests, or entry points. Start by reviewing JSON-B’s existing annotation and serialization API alongside the cited Jackson annotations. This needs an agreed scope for entity serialization, deserialization, managed references, and entity-manager integration before completion can be defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.