-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Mapping Enum with HBM file
PostPosted: Tue Nov 04, 2008 3:16 am 
Newbie

Joined: Tue Nov 04, 2008 3:07 am
Posts: 9
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 :

Code:
       public class Note{
   private String noteName;
   private NoteType type;
}
Public enum NoteType{ text_note,image_note,reminder_note};



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:


Code:
<class name="com.comp.domain.Note" table="app_note" lazy="false">
<property name="type” column="note_type" >
   <type name="EnumUserType">
   <param name="enumClassName">com.comp.enums.NoteType</param>   </type>
</property>



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

After half day goggling on this matter I found another suggestion :
http://forum.hibernate.org/viewtopic.php?p=2377095

Code:
<property name="myfield" length="30">
   <type name="org.hibernate.type.EnumType">
      <param name="enumClass">org.judge.myenum</param>
      <param name="type">12</param>
   </type>
</property>


this code throws this Exception:
MappingException: "Could not determine type for": org.hibernate.type.EnumType

I published the question in other ORM forum but didn't get an answer..
Hope you guys can help

Sharon


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.