I just stumbled onto a problem with parameterized enums while experimenting with JBossIDE and EJB3. Some of my entities have embedded components which are enums.
If I deploy, the tables are created correctly (components embedded in same table as containing entity...). But actually trying to persist an instance of this entity fails with an EJBException:
"org.hibernate.InstantiationException: No default constructor for entity"
Sure, it's true: my enum has no default constructor. But it's not allowed to have one!
The compiler (Java 5.0.6) says only private constructors are allowed. From various examples on the web I take it that simple enumerations are no problem, but as soon as I parameterize it, Hibernate seems to think of the enum as an entity and tries to instantiate it with a public default constructor...and fails.
Are parameterized enum not supported (using JBoss 4.0.3 with EJB3 Hibernate persistance)? Or have I missed some important point?
Right now the only workaround I see is extracting the embedded enum component into a separate entity. The enum solution seems much more elegant though...
Any input would be much appreciated