-->
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: Using a ParameterizedType as the type for an id
PostPosted: Tue Apr 08, 2008 10:25 am 
Newbie

Joined: Tue Aug 28, 2007 3:35 pm
Posts: 7
Hi,

I'm attempting to use a ParameterizedType for an id in Hibernate, just as you would for a property.

Code:
<id name="identifier" access="field">
    <type name="MyParameterizedUserType">
      <param name="someParameter">myParameterValue</param>
    </type>
</id>


The problem is that Hibernate complains that my <id> element does not contain the required attribute "type". Using a <type> sub-element works for normal properties, but doesn't seem to for ids.

Is there any way around this? I'm sure I've seen a solution before but can't find any examples.


Thanks
cjsceats


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 08, 2008 10:54 am 
Newbie

Joined: Tue Aug 28, 2007 3:35 pm
Posts: 7
For anyone interested, I have remembered the solution to this - you define a type definition for the ParameterizedType beforehand, so that you don't have to declare the <type> element in-line:

Code:
<typedef name="MyParamType" class="MyParameterizedUserType">
  <param name="myParam">myValue</param>
</typedef>


It's a shame that Hibernate doesn't support in-line usage in <id> elements though - its seems a little inconsistent to provide support in some places but not in others.


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.