Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mapping Enum to field � the old way

 
Sharon whipple
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Till now I used Enums in domain objects with no problem,
Just add the Hibernate annotation:
@Enumerated(EnumType.STRING)

And the domain field saved to the db as selected by the EnumType

Now I am working on different application and trying to use enum in one of my domain object fields

For example:
My domain class is :



The application uses �hbm� files and I am trying to set the hbm to work with the Enum field (NoteType) so I configured set the hbm like:



But it wont work, the application keep throwing these exceptions:
�Arithmetic overflow error converting varbinary to data type numeric�

Please advise
Thank you
Sharon
 
Sharon whipple
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After aprox half day goggling on this matter I found partial solution
Here is an explanation on how to configure the hbm to save the value as varchar :

http://forum.hibernate.org/viewtopic.php?p=2377095


But saving the field as string will require more space and will reduce performance.

Just checked this configuration and its throwing ecxeption:
MappingException: "Could not determine type for": org.hibernate.type.EnumType
[ October 28, 2008: Message edited by: Sharon whipple ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic