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?