ADF BC: Polymorphism and relations
bkummelMar 11 2009 — edited Mar 31 2009Hi,
I'm building an ADF 11g application. In our data model, we have a table that contains four different types of transactions, all with the same attributes (columns). One column contains the transaction type and is the discriminator column. We also have customers, and each customer can have different types of transactions. In the database there is a foreign key relation between customers and transactions.
In the user interface, there is a separate screen for each type of transaction. We added each type of transaction as a separate View Usage in the application module and used View Criteria to show only transactions of one kind. But now we want to have some default values set on the transactions and the default values depend on the type of transaction. Since default values are set on Entity Objects, I thought I'd need Entity polymorphism to accomplish this. There is a section on this topic in the [Fusion Developers Guide|http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcadveo.htm#sm0327]. I figure I also need polymorphic view rows, [as described in another section of the dev guide|http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcadvvo.htm#sm0515].
But what I can't find anywhere on the internet is how to use polymorphism with Entity Associations and View Links. I don't want to define links for every sub type. I'd think that it should be enough to define the assocation/link on the top level. But I can't find any documentation on this. Another thing is that it seems that there is no way to have an "abstract" Entity or View Object. We have four types of transactions, let's call them A, B, C and D. On the Entity side, I'd like to have an abstract TransactionEO and four concrete Transaction+X+EO's. (Where X is one of the four types.) But it seems ADF BC forces me to use one of the four types as the default type and use that default type as the super class. Am I missing something here?
To summarize, I'd like the following questions to be answered:
<ol><li>How to use polymorphism in conjunction with Entity Associations and/or View Links?</li>
<li>Is it right that I have to use one of my discriminator values as a default and use that default on the super type? (IOW: Is it right that there cannot be an abstract super Entity?)
</li>
<li>I noticed that a search on "polymorphism" on this forum returned zero results. Does that say anything about how much polymorphism is used in real life projects?</li>
</ol>
Thanks in advance for any help!
Best regards,
Bart Kummel