Please
UseCodeTags
It looks like there is a user_id in the user table. Is that the id field? Why are you using @PrimaryKeyJoinColumn on the Role object?
The two things to remember when mapping bi-directional one-to-one
1. The @JoinColumn annotation goes on the mapping of the entity that is mapped to the table containing the join column, or the owner of the relationship. This might be on either side of the association.
2. The mappedBy element should be specified in the @OneToOne annotation in the entity that does not define a join column, or the inverse side of the relationship
Since it looks like Role contains the join column (user_id) it looks like it is the owner.
Role.java
User.java
Also when you do Role role = new Role(); where are you setting the user on the role object? When you call dao.update(user); is that a merge?