I have a Validity object which contains two dates, start and end. I have a UserType that I've written for this so that I can simplify the hibernate mappings for the several entities that have one. That works fine.
Now I want to add a set of weekdays to Validity. The only solution I can figure out is to change each entity to treat Validity as a component, with the weekdays mapped as a .
Is there some way to use do this with a *UserType?
class Validity {
Date start;
Date end;
Set<DayOfWeek> daysOfWeek;
}
enum DayOfWeek {SUNDAY, MONDAY, TUESDAY ... }