Hello,
I have an abstract BillingDetails superclass and 2 classes which extend this, namely Account and CreditCard (both of these classes have further Objects mapped onto them)
A Payment class has a BillingDetails attribute.
If I run a hibernate query "find all Payments" then I get back a mixture of payments made with both Accounts and Credit Cards. However if I wish to map this payment to my DTO (yes..yes I know anti-pattern) the hibernate stub class is not an instance of either Account or CreditCard (it's a stub holder) so I can't seem to differentiate between the two for the mapping.
Just setting the billingDetails directly on the Payment object gives me the 'session no longer open' error when I try and examine the contents. (Which is true)
Must I have a 'payment_type' attribute to distinguish the two on BillingDetails? Or is there a more clever way to distinguish between the two which doesn't rely on that contrived attribute?
|