-->
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: How to map Map<[Enum], [Entity]> using XML mapping
PostPosted: Mon Jan 21, 2008 6:02 am 
Newbie

Joined: Mon Jan 21, 2008 5:31 am
Posts: 2
Hi all,

We've got a db structure like this:

ORGS (id, name)
CATEGORIES (id, parent, name, provider)
ORG_CAT (org_id, provider, cat_id)

We use many Category systems and Providers are the owners (or creators) of those systems. In one system, one ORG can only be associated with one Category.

The list of providers is rather static so we want to use Enum like this:



Code:
public enum CategoryProvider {
   A("A"),
   B("B"),
   C("C");

   private CategoryProvider(String name) {
      this.name = name;
   }
}


We've been able to map the "provider" property of Category as CategoryProvider as follows:
Code:
   <property name="provider">
      <column name="provider"/>
      <type name="org.hibernate.type.EnumType">
         <param name="enumClass">CategoryProvider</param>
         <param name="sqlType">12</param>
      </type>
   </property>


We want to have a map like this in ORG:
Code:
   Map<CategoryProvider, Category>categories;


The problem is the <map-key> element only accept "type" as attribute and we haven't found the way to specify the "enumClass" parameter anywhere.

Anyone could lend a hand? Thanks very much.

Kean.


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.