Paul,
I have a class, RoleList, that has a single data member called roles that is a set of strings (the class definition is in my first message).
If I were managing the
JDBC manually, I would create a table named ROLES that has a single column where every row contains a single string which is the name of one of the roles. Something like this:
create table ROLES (role varchar(255) not null);
Then when I instantiate my RoleList object, I would query the db like this:
select * from ROLES;
and iterate over the result list, taking each string and putting it into the set of strings in my RoleList object.
What I'm having trouble with is figuring out how to create a RoleList.hbm.xml file that would allow hibernate to do the same thing. As you point out, using the set element in the hbm.xml file creates an association, and therefore an unnecessary table (as well as requiring an equally pointless key attribute in RoleList to allow the association to work).
Any advice you can give me would be appreciated.
Steven Gollery