Re: accessing enum

Jon Drukman <[email protected]>
Newsgroups gmane.comp.db.mysql.java
Message-ID <[email protected]>
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-



-- 
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.