Hi, I have a simple global status field in many of my entity classes (for example, User, UserGroup, Organisation) that should be either set to "LIVE","DEAD" OR "SUSPENDED". One way I could implement this is just using a string field in each of the classes. However, I would prefer to record an entities state using an id (eg id_status) which would be a foreign key to a status table with 3 entries for "LIVE","DEAD" OR "SUSPENDED". Is it possible to have multiple many to one mappings from several classes that point to a single class?
public class GlobalStatus { private Long idGlobalStatus; private String name; ... }
public class User { private Long idUser; private String email; private GlobalStatus status; ...
}
public class UserGroup { private Long idUserGroup; private String name; private GlobalStatus status; ...
}
|