I have a few classes similar to this example:
Code:
public class User{
List<Group> primaryGroups;
List<Group> secondaryGroups;
}
I want Hibernate to generate the schema for me, for everything else in my app it was worked great.
When it see two collection to the same class annotated with either @Many-to-Many or @CollectionOfElements it creates one table between User and Group with one column for each collection.
ie
Code:
CREATE TABLE USER_GROUP (
USER_PK INTEGER NOT NULL
PRIMARYGROUP_GROUP_PK INTEGER NOT NULL
SECONDARYGROUP_GROUP_PK INTEGER NOT NULL
)
The problem with this is that I cannot have either collection be empty. Since all of the columns are keys they are not allowed to be null.
Is there away to annotate this so they it creates separate tables or allows for nulls?
I have been beating on this all day, any help would be greatly appreciated.
Thanks,
Mike