tenwit wrote:
Enums are constants: values, not entities. They do not have variable bits. If you need to load values from the database, then they're entities, as you correctly point out. Therefore, they're not enums, and should not be mapped as such. That's why you haven't been able to find any examples on this sort of thing.
Ok - I can agree with this up to a point, but the situation was that I had a fixed number of known entities and just wanted some of those entities' fields to be loaded from the database (and not hard-coded). To me this is still a perfectly valid use for an enum.
Regardless, the requirements have changed slightly to mean that my entities must now 'extend' from another table, which is mapped as a separate persistent object. Enums can't have any inheritence relationships, so I'm going to need another approach anyway (for the record, I'm planning to write a plain object for the entity and then declare the known instances as static fields within this class, but stipulate that all calling classes must pass these objects to a DAO before use to get back a version that is attached to the current session).
Thanks to both for your help.