-->
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: Querying unmapped interfaces via implicit polymorphism
PostPosted: Wed Jun 16, 2004 7:22 am 
Newbie

Joined: Wed Jun 16, 2004 6:49 am
Posts: 4
Consider the following example of 'table per subclass' inheritance mapping:

Code:
<class name="Payment" table="PAYMENT">
   <id name="id" type="long" column="PAYMENT_ID">
      <generator class="native"/>
   </id>
   <property name="amount" column="AMOUNT"/>
    ...
   <joined-subclass name="CreditCardPayment" table="CREDIT_PAYMENT">
      <key column="PAYMENT_ID"/>
      ...
   </joined-subclass>
   <joined-subclass name="CashPayment" table="CASH_PAYMENT">
      <key column="PAYMENT_ID"/>
      ...
   </joined-subclass>
   <joined-subclass name="ChequePayment" table="CHEQUE_PAYMENT">
      <key column="PAYMENT_ID"/>
      ...
   </joined-subclass>
</class>


If the classes 'CashPayment' and 'ChequePayment' implement the interface 'NonelectronicPayment' (which is not described anywhere in the mapping) will hibernate support queries of the form:

"from NonelectronicPayment np where np.id = 1234" (where 1234 is the id of the Payment that must be retrieved)

Also if this query is supported will the returned object still be of type 'CashPayment' (or 'ChequePayment' )?

Is support for this behaviour via 'implicit polymorphism'? If so which versions of hibernate support 'implicit polymorphism'?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 16, 2004 8:00 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Yes, this is supported. Why don't you just try it?


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.