Hi all,
I would like persist Java5 enumerations in another way.
Persisting enumeration using integer or varchar is usefull, but sometimes I thing it is not enough. Am I the only one who has this requirement ?
Here such a use case:
I have a Car object which has a TypeOfCar. I'd like to use Java5 enumeration for representing TypeOfCar. But I'd like to persist these types of car just like other entities, bound to the car with a ManyToOne association.
Using Java5 enumeration, compilation ensures that I have only 2 types of car (small, 4x4 for example).
Persisting them like other entities enable these types to have their own states, their own fields, and also some others relations.
I also imagine it would be possible to extract some parts of the ddl like data initialization (initialization of data which are required at runtime, which are constant).
Is there an elegant way for doing this with Java5 annotations ?
Thanks in advance,
Jeff
|