Hi,
If I understand correctly you want to map a one to one relationship using shared primary keys. You will have to use
@OneToOne together with
@PrimaryKeyJoinColumn. See
http://www.hibernate.org/hib_docs/annotations/reference/en/html_single/#d0e1001.
You are responsible for setting the right id in UserDetails. If you have a bidirectional relationship, meaning the UserDetails has a reference back to User you can also utilize the @GenericGenerator annotation -
http://www.i-proving.ca/space/Technologies/Hibernate/Hibernate+Annotation+Examples/One+to+One+Mapping.
Hopefully this was not too far off from what you actually asked ;-)
--Hardy