[jboss-user] [EJB 3.0] - Problem with enum datatype
imranpariyani
do-not-reply at jboss.com
Tue Jun 26 16:55:10 EDT 2007
hello
I have a problem with the enum datatye. If i try to get an entity with enum as a field in it every thing works fine the problem occurs when i have a native query with only the enum field ..
for example :
| String query = "SELECT DISTINCT type FROM card WHERE type IS NOT NULL ORDER BY type";
| return this.manager.createNativeQuery(query.toString()).getResultList();
as output instead of the enum string i get only the first character .. here is the debug output of jboss
| 2007-06-26 22:10:57,267 DEBUG [org.hibernate.SQL] SELECT DISTINCT type FROM card WHERE type IS NOT NULL ORDER BY type
| 2007-06-26 22:10:57,316 TRACE [org.hibernate.type.CharacterType] returning 'M' as column: type
| 2007-06-26 22:10:57,316 TRACE [org.hibernate.type.CharacterType] returning 'V' as column: type
| 2007-06-26 22:10:57,317 TRACE [org.hibernate.type.CharacterType] returning 'E' as column: type
| 2007-06-26 22:10:57,318 TRACE [org.hibernate.type.CharacterType] returning 'N' as column: type
|
the question is why does it map the enum datatype of mysql to charactertype instead of string ..
It sounds like a silly question but as i am new to ejb3 i had no other option but to ask :)
Awaiting response ..
thanks
Imran
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4057889#4057889
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4057889
More information about the jboss-user
mailing list