It seems to be a very strange behavior when it comes to Entity Inheritance and Passivation-Activation.
Download the Sample Application
Lets Say that we want to create an application that wants to do the following:
1) Use Entity Inheritance
2) Have one View Object and interact with it, leaving the inheritance do the magic
3) Create an insert Operation to the subtype. The method will reside in the AM and exposed to the client interface.
4) Create a sample jspx and drop a Form of the View Object.
5) Drop the insert operation onto the jspx sample page.
6) Have our application tested with and without the AM pooling.
Implementation:
Lets take those steps one by one:
1)
As Far as the Entity Inheritance, we will follow the ADF documentation that describes us how to do it:
http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcadveo.htm#sm0327
First we create the Employees entity.
In the Employees Entity, we set the attribute JobId as the discriminator Attribute. We do not set any Default Value in this attribute since we want to handle all case that are not included in the subtype.
Next, we create another Entity that extends the Employees entity. The name is EmployeesAC_ACCOUNT
In the EmployeesAC_ACCOUNT we have set a Default Value in the Discriminator Attribute: "AC_ACCOUNT"
2)
To create a View Object with prolymorphic entities, we follow the ADF documentation that describes how to do it:
http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcadvvo.htm#sm0515
This means that we create a viewObject based on the entity, and then add the subtypes
3) In Order to create a row in the subtype, we follow the documentation of the step 2) and specifically the chapter:
39.6.4.3 Creating New Rows With the Desired Entity Subtype
So we created a method in the Application Module that does the following:
4) Next, we create a simple page with a Form of the Employees View Object.
A Drag n Drop in the ADF world..
5) We expose the AM method in the client interface and we drop it as button in the Form
In Result we have the following layout:
If we run the application and press the create button we will see the following:
As you can see, the discriminator value has the value passed from the create method.
If we set values to all fields and then press submit, the form is submited correctly.
This functionality works very well.
5) But according to decoumentation:
http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcstatemgmt.htm#CHDGAIFA
We have to test our application with the Inheritance we did, without the Application Module pooling.
Note: for a detailed explaination of how to remove it you can check a blog post:
http://jdeveloperfaq.blogspot.com/2010/02/faq-14-how-to-test-application-module.html
After we uncheck the pooling in the Application Module. we run the page again.
We press the create button and we insert data. But when we press submit, where the passivation and the activation takes place we have error messages on the page that the required attributes have no values!!
so, from this state:
we press submit we end up to this state:
Am I missing something here?
Download the Sample Application
Regards.
Dimitri, there are issues related to passivation in version 11.1.1.3.0 of JDeveloper. Specifically, the EOs are NOT passivated! This explains the behavior you see since the EO is not activated properly. Test your sample application with version 11.1.1.2.0 - it should work just fine.
ReplyDeletehi Dimitrios
ReplyDeleteThis looks like it could be related to what is described in forum thread "ADF BC : polymorphic activation issue"
at http://forums.oracle.com/forums/thread.jspa?threadID=1108959
regards
Jan Vervecken