Java: compile conflict: return type is incompatible with HATEOAS ResourceSupport.getId
java, jpa, rest, spring, spring-hateoas
Solution
Check out the "Link Builder" section of the documentation:
http://docs.spring.io/spring-hateoas/docs/current/reference/html/#fundamentals.obtaining-links.builder
There, it describes how to use a `ControllerLinkBuilder` to create the `Link` using a separate controller class. Your `User` Object would implement `Identifiable<Long>`, as the example in the page above shows.
Problem
So I have this HATEOAS entity. ``` @Entity @Table(name="users") public class User extends ResourceSupport { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="id") private long id; public User() { } public Long getId() { return new Long(id); } public void setId(Long id) { this.id = id.longValue(); } } ``` My entity has an id of type long, but HATEOAS's ResourceSupport requires that getId return a Link. The entity has a Long id because the db has a long id, and it is a persisted entity. How can I implement this entity with HATEOAS?