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.  [ 1 post ] 
Author Message
 Post subject: Not sure how to map interface scenerio.
PostPosted: Fri May 23, 2008 11:38 am 
Newbie

Joined: Wed Oct 31, 2007 1:50 pm
Posts: 13
I have a scenerio where have an abstract base class PaymentBase (example). There are different implementations, (i.e. CreditCardPayment, WireTransferPayment, etc) that are joined-subclasses. This works OK, but we also have a second PaymentPreferenceBase abstract class which has duplicate 1-to-1 subclasses as the previous PaymentBase.

I was hoping to avoid this irritating duplication, but providing an IPaymentPreference interface that such that preference classes would inherit their corresponding PaymentBase and the IPaymentPreference interface. Problem is I don't know how to map the IPaymentPreference?

Here's what we have now as far as mapping to hopefully make it a bit more clear:

Code:
<class name="Blah.Model.Membership.Preferences.PaymentPreference, Blah.Model" table="PaymentPreference" lazy="false">
    <id ... />

    <property name="NickName" type="String" not-null="true" />

    <!-- Classes which implement PaymentPreference are mapped below: -->
    <joined-subclass name="Blah.Model.Membership.Preferences.CreditCardPreference, Blah.Model" table="CreditCardPreference" lazy="false">
         ...
    </joined-subclass>
    <joined-subclass name="Blah.Model.Membership.Preferences.eCheckPreference, Blah.Model" table="eCheckPreference" lazy="false">
         ...
    </joined-subclass>
</class>


Code:
<class name="Blah.Model.OrderManagement.CustomerOrderPayment, Blah.Model" table="CustomerOrderPayment" lazy="false">
    <id ... />

    <joined-subclass name="Blah.Model.OrderManagement.CreditCardPayment, Blah.Model" table="CreditCardPayment" lazy="false">
       ...
    </joined-subclass>
    <joined-subclass name="Blah.Model.OrderManagement.eCheckPayment, Blah.Model" table="eCheckPayment" lazy="false">
       ...
    </joined-subclass>


The duplication issue, obviously, arises, because CreditCardPreference cannot inherit from both CreditCardPayment and PaymentPreference. Anyone have any ideas?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.