Description
Hi everyone.
As per this discussion and others I read elsewhere, it should be possible to use @JsonIgnoreProperties
to hide properties of entity properties. However, I performed several tests and sometimes it works, sometimes it doesn't.
In the simplest case, an User
entity that has an @OneToOne
relationship with an UserPermission
entity cannot hide UserPermission
's hidden
property via @JsonIgnoreProperties("hidden")
, when accessing a @RepositoryRestResource
via REST.
If the repository is used with excerptProjection = UserProjection.class
, and the projection uses UserPermission
instead of UserPermissionProjection
, it works. If both are projections, it doesn't work.
By @Autowired
ing an ObjectMapper
, doing the serialization in a @RepositoryRestController
and printing the result with System.out
, any case works.
Here's a project that reproduces the issue. Clone/download, build with Maven, run DemoApplication.java
and access http://localhost:8080/users
from any browser. The hidden
properties should not appear.
Thanks in advance.