I have a JPA entity that i am building hateoas links for:
@Entity
public class PolicyEvent extends ResourceSupport`
I want the hateoas links generated to be persisted in the PolicyEvent table
.
JPA doesn't seem to be creating columns in the PolicyEvent table
for the _links member in the resourcesupport.
Is there some way to persist the links member via JPA or is my approach itself incorrect (the Hateoas link data should not be persisted).
Thank you
I'd advise not to mix JPA entities and HATEOAS Exposed Resources. Below is my typical setup:
The data object:
The repository:
The HATEOAS resource:
The service implementation (interface not shown):
Finally, the controller that exposes the resource:
The
@ExposesResourceFor
annotation allows you to add logic in your controller to expose different resource objects.