Hibernate version: 3b4
I have read the docs (and am a little confused), I have also searched the forum (and google) and haven't found the answer to my question, which is: how I can get the below relationship to be mapped
DB:
user { id not null primary key, username }
userdata {username, key, value }
userdata.username = user.username however user.username can be null i.e. there will be cases where the user.username is null and thus there is no userdata tuples
Java:
user {
private int id
private String username
private HashMap userdata
}
Hibernate:
user {
<id name="id" column="id" type="long">
<generator class="native"/>
</id>
<property name="name" column="name" type="string"/>
<map name="userdata" ????
}
So my question is how do I complete this relationship given that userdata.username can't be a FK as user.username can be null?
|