-->
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: Polymorphic associations, annotations, <any>
PostPosted: Fri Oct 28, 2005 1:24 am 
Newbie

Joined: Thu Oct 27, 2005 7:39 pm
Posts: 1
I'm using Hibernate 3.1 beta 3.

I need to map a polymorphic association very much like the table-per-concrete class Payment example in Chapter 8 of the Hibernate Reference Documentation.

The end result would be a
Code:
Payment payment = getPayment();
method that would return an instance of one of the concrete subclasses of Payment.

Using a mapping document I would use the <any> element. From the reference:
Code:
<any name="payment" meta-type="string" id-type="long">
  <meta-value value="CREDIT" class="CreditCardPayment"/>
  <meta-value value="CASH" class="CashPayment"/>
  <meta-value value="CHEQUE" class="ChequePayment"/>
  <column name="PAYMENT_CLASS"/>
  <column name="PAYMENT_ID"/>
</any>


Can you do this using annotations? What annotations would you use?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 8:15 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Any is not supported through annotations

_________________
Emmanuel


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.