8 messages in com.mysql.lists.javaRe: accessing enum| From | Sent On | Attachments |
|---|---|---|
| Jon Drukman | 01 Nov 2006 11:17 | |
| Christopher G. Stach II | 01 Nov 2006 14:35 | |
| Jon Drukman | 01 Nov 2006 14:39 | |
| Christopher G. Stach II | 01 Nov 2006 14:46 | |
| Jeff Mathis | 01 Nov 2006 15:10 | |
| Jon Drukman | 02 Nov 2006 16:02 | |
| Mark Matthews | 02 Nov 2006 17:29 | |
| Christopher G. Stach II | 02 Nov 2006 17:38 |
| Subject: | Re: accessing enum![]() |
|---|---|
| From: | Jon Drukman (js...@cluttered.com) |
| Date: | 11/02/2006 04:02:52 PM |
| List: | com.mysql.lists.java |
Christopher G. Stach II wrote:
How is it being retrieved? :)
Looks like our programmer figured it out:
"The problem is that we are using EJB3 implemented by Hibernate. We’ve got a set of entity beans defined that represent the table structure. I was having issues in how I defined the Primary Key class for the file_sha1 table entity bean in that I had the type field defined as a java Enum that I had written and annotated as a EnumType.STRING. But looking at the resultant SQL that was generated by the JBoss container, it was using numeric values that corresponded to the java Enum — even though the field was annotated with EnumType.STRING. It was driving me nuts first that the driver was still using the numeric values and that the driver didn’t take into account that the Enum index in MYSQL is 1-based and did a 0-based numeric correspondence in the generated SQL. I finally found a way of overriding the default behavior and forcing the driver to use the string value of the java Enum (thus respecting the annotation of EnumType.STRING on the type field in the file_sha1 entity bean) and that seems to work."
Reminds me why I don't do java.
Thanks for your help! -jsd-




