-->
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.  [ 2 posts ] 
Author Message
 Post subject: Mapping enums that are defined in a domain class
PostPosted: Tue Oct 11, 2011 7:51 pm 
Newbie

Joined: Thu Jun 14, 2007 6:14 pm
Posts: 15
I have a bunch of status type enums that I need persisted, and a domain class that it is related to, such as:
Task
TaskStatus (defined as an enum within the Task class)

I've been using this in my hbm file:
Code:
<property name="priority" column="priority"
      length="255" not-null="true">
         <type name="org.hibernate.type.EnumType">
            <param name="enumClass">task.Task.TaskStatus</param>
            <param name="type">12</param>
         </type>
      </property>


But I am getting a hibernate exception saying 'Enum class not found' and a corresponding ClassNotFoundException, even though it can be referenced in separate classes fine. If I break out the enum into its own class file, the mapping works. However this introduces a lot of clutter because there are several of these small enums that really should be bundled up with their domain object.

Is it possible in any way to map to an enum thats defined inside a domain object? I've tried changing the enum declaration to: public static enum TaskStatus, but the static modifier doesn't help. Any ideas?


Top
 Profile  
 
 Post subject: Re: Mapping enums that are defined in a domain class
PostPosted: Tue Oct 11, 2011 9:35 pm 
Newbie

Joined: Thu Jun 14, 2007 6:14 pm
Posts: 15
Nevermind, I fixed it with the following enumClass: task.Task$TaskStatus


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

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.