Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Enum as datatype for fields
PostPosted: Mon May 30, 2011 4:09 pm 
Newbie

Joined: Sat May 21, 2011 7:40 am
Posts: 15
Hello!

I would like to use an enum as datatype for a field and i already found some basic instructions on how to do this on google.
I don't want to use annotations, so the xml way is the only one i can go.
I have found a class GenericEnumUserType on http://community.jboss.org/wiki/Java5EnumUserType which probably works as i need it.
My xml entry looks like this:

<typedef name="permission" class="model.enums.GenericEnumUserType">
<param name="enumClassName">model.enums.PermissionEnum</param>
</typedef>

<class...
<property name="permission" type="permission">
<column name="permission"/>
</property>
...

The first problem is that the datatype of the field is GenericEnumUserType when i process the hbm.xml with hbm2java.
The next thing is that i can not put my typedef-entries into a separate file, they have to be in the same file as they are used in, otherwise the type is not set correctly.
Please help me with this!

Thanks in advance!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.