There is a bit at the end of section 5.1.11 in the hibernate documentation about this (
http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#mapping-declaration-onetoone).
It is a little bit unintuitive but you need to use a many-to-one association with the unique setting set to true instead of one-to-one.
So for your particular case I would expect the mapping for the Student class to contain something like:
Code:
<many-to-one name="locker" class="Locker" column="lockerid" unique="true"/>
If the association is bi-directional then I would also expect the mapping for the Locker class to contain something like:
Code:
<one-to-one name"student" class="Student" property-ref="locker"/>
Cheers