I switched from WildFly to OpenLiberty and in OpenLiberty Eclipselink is the default JPA provider. I am using the default JSON-B to convert the entity to a JSON object:
@Path("test")
public class TestResource {
@GET
public Response response() {
JsonbConfig jsonbConfig = new JsonbConfig();
jsonbConfig.withPropertyVisibilityStrategy(new PrivateVisibilityStrategy()); // allow private fields to being displayed
jsonbConfig.withNullValues(true);
return Response.ok(JsonbBuilder.create(jsonbConfig).toJson(new TestEntity())).build();
}
}
@Entity
public class TestEntity {
@Id
@GeneratedValue
private Long id;
}
And the response:
{
"_persistence_fetchGroup": null,
"id": 1
}
I can however not allow null
values to be displayed at all, but that is not what I want, because I have other values which can be null and must be displayed.
How can I remove this property _persistence_fetchGroup
from being processed by the JSON builder in Java EE 8?