-->
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: Allowing user types within the keys of composite ids
PostPosted: Thu Aug 11, 2005 9:12 pm 
Newbie

Joined: Mon Jun 06, 2005 11:21 pm
Posts: 10
Hibernate version: 3.0rc1

Hello,

I have been trying to use a composite key which has, among its key properties, a user defined type that requires parameters. So, hypothetically, I'd like my mapping file to look something like:

Code:
<class name="Senator" table="us_senate">
   <composite-id>
      <key-property name="state">
         <type name="EnumUserType">
            <param name="enumClassName">State</param>
         </type>
      </key-property>
      <key-property name="rank"/>
   </composite-id>
   ...
</class>


Unfortunately, the mapping DTD doesn't seem to allow these kinds of nested type elements and, as far as I know, I can't toss parameters into a type attribute. I was wondering if I was missing something about why Hibernate doesn't support such a thing.

Any elucidation would be greatly appreciated. To be honest, I'm after understanding more than I'm after a workaround here.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 12, 2005 2:24 am 
Expert
Expert

Joined: Thu Sep 04, 2003 8:23 am
Posts: 368
As parameterized types are new in hibernate 3 maybe this is a missing functionnality. You can create a JIRA issue to ask for this addition.
Alternatively you can create a typedef like this
Code:
<typedef class=".." name="enumState">
  <param name="enumClassName">State</param>
</typedef>

the only problem is that you have to create one typedef per parameter value

_________________
Seb
(Please don't forget to give credits if you found this answer useful :)


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.