I have an entity User and it should have property manager where manager is another user (one manager can manage many users, any user may have only 1 manager or have not any).
How can I implement this?
I tried something standard
@ManyToOne
@JoinColumn (name = ??? /* what should be here? */, nullable = true)
private User manager;
but it’s not as simple as it seems..
What’s the problem? Use the default value i.e. don’t set the
nameif you don’t know how to name the join column (should default to something like MANAGER_ID). From the javadoc of thenameattribute: