-->
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.  [ 3 posts ] 
Author Message
 Post subject: <ANY> with composite id
PostPosted: Sat Jun 04, 2005 8:49 pm 
Beginner
Beginner

Joined: Sat May 07, 2005 12:01 pm
Posts: 33
I've searched all over for the solution to this, but no clue. I want to use an <ANY> mapping to entities that all have composite IDs:

Code:
<class name="Parent">
  ...
  <any name="child" meta-type="integer" id-type="long,timestamp">
     <meta-value value="1" class="Child1"/>
     <meta-value value="2" class="Child2"/>
     <column name="child_type"/>
     <column name="child_id"/>
     <column name="child_ts"/>
  </any>
  ...
</class>


Children look like this:

Code:
<class name="Child1">
  <composite-id>
    <key-property name="id"/>
    <key-property name="timestamp"/>
  </composite-id>
</class>


Looks fine to me, but I get: property mapping has wrong number of columns: Parent.child type: object

Thanks for any help!

Jen


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 04, 2005 9:07 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
"long,timestamp" is not a type.

Best solution is to use a CompositeUserType instead of the <composite-id> mapping.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 04, 2005 9:26 pm 
Beginner
Beginner

Joined: Sat May 07, 2005 12:01 pm
Posts: 33
Thanks for the fast reply!

gavin wrote:
Best solution is to use a CompositeUserType instead of the <composite-id> mapping.


I have to keep "id" and "timestamp" as separate properties of the Child objects. It looks like CompositeUserType would require me to wrap up both elements into a single property. I suppose i could generate a temporary composite object on the fly, but I was wondering if there is a mapping semantic that supports multiple key columns -- if so, where would I specify their types, since "id-type" appears to apply to a single column only?

Thanks!

Jen


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.