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
thx


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3914064#3914064

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3914064


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to