I have an entity that represents a table using Spring data.
@Entity
@Table(name="User")
public class User {
@Id
@GeneratedValue
@Column(name="user_id")
private Long userId;
@Column(name="username", unique=true, nullable=false)
private String username;
@Column(name="email", unique=true, nullable=false)
private String email;
.....
For example, we'll say we have a user in the database with user id set to 1 and username set to bob. Spring makes this resource available at http://localhost:8080/users/1. What I would like to do is make it availabe at http://localhost:8080/users/bob instead.
Is this possible, and how?
Edit: According to this answer on another question, using the embedded id annotation seems to accomplish my goal, however, it is a hack, and I would like to implement it more correctly.