-
1. Re: Hibernate enum bug ?
epbernard Nov 17, 2005 6:58 AM (in response to elkner)use enum.ordinal() for now in the setParameter(),
This is going to be addressed in the spec -
2. Re: Hibernate enum bug ?
epbernard Nov 17, 2005 7:00 AM (in response to elkner)FYI, Hibernate does not choose numeric, it checks the column to guess the type. Of course if you create the schema from Hibernate this is not possible
-
-
4. Re: Hibernate enum bug ?
simon.nicholls Feb 14, 2006 5:46 PM (in response to elkner)Any more info on the spec situation regarding this? I didn't find anything in PFD spec, but I guess it was released too soon to have the issue resolved by then.
-
5. Re: Hibernate enum bug ?
elkner Feb 14, 2006 8:07 PM (in response to elkner)see "9.1.19 Enumerated Values" in the Java Persistence API PFD
-
6. Re: Hibernate enum bug ?
simon.nicholls Feb 16, 2006 6:57 AM (in response to elkner)My enum mappings work fine except for when used as parameters in EJB-QL queries, so I guess I've got a completely different problem, though symptoms looked the same when I searched the forum. I misread the comments below is thinking that it was EJB-QL issues that would be addressed.
Looks like I get a serialized enum stuffed into the parameter, rather than the ordinal or name as annotation declares. This from the MySQL query log, at the point the parameter is inserted:
'’\0~r\0\'example.MyEnum\0\0\0\0\0\0\0\0\0\0xr\0java.lang.Enum\0\0\0\0\0\0\0\0\0\0xpt\0\rTEST_ENUM_TYPE'
I'm using JBoss 4.0.4RC1, MySQL 5.0.18, and MySQL-connector 3.1.12. Use of ordinal or name methods work fine though of course. Any ideas? -
7. Re: Hibernate enum bug ?
elkner Feb 16, 2006 11:41 AM (in response to elkner)This was a problem with 4.0.3SP1 (EJB RC3) - one had to use enumvar.ordinal(). The ordinal stuff however does not work anymore with 4.0.4RC1. So I removed .ordinal() from all parameters and it works as expected.
So at least for me everything is fine with enums now (using MySQL 5.0.15, connector 3.1.12).
Are you sure, that you are using EJB RC5 and the related recent hibernate libs ? -
8. Re: Hibernate enum bug ?
simon.nicholls Feb 20, 2006 1:36 PM (in response to elkner)I used the installer for 4.0.4RC1, and selected the ejb3 option during the install process, which should give me RC5. I've also tried updating the hibernate and EJB3 libs manually to latest versions, and still get the same problem. Files inside my 4.0.4RC1 installer are stamped 07/02/06 21:24
Hmmm...I wonder what could be causing my problem. I'm using field annotations, named parameters, and enums defined in seperate files, but can't imagine those would be factors. Tinyint as my db datatype? Nah. I'm not sure what to consider next at this point, as it seems all should be working (and does outside of EJB-QL). However, it's good to know that enums are supported now in the way I hoped they'd be, and thanks for helping. -
9. Re: Hibernate enum bug ?
simon.nicholls Feb 22, 2006 5:47 AM (in response to elkner)The other thing I'm using, which I forgot to mention, is named queries declared at class level. Anybody else had success/failure with enums in EJB-QL?
-
10. Re: Hibernate enum bug ?
elkner Feb 22, 2006 7:36 AM (in response to elkner)Just to make sure: your enums are not annoted with @Embedded or something like that, are they? For a shot into the blue, just remove all annotations from your enum and check, whether it works...