问题
i have Table1 with 5 columns and corresponding viewObject1
ID Value1 Value2 Value3 Value4 Value5
and there was ADF Form where all those values would inserted manually with inputTexts
but there is a complex enhance need to be done in this form which is :
if selected RemoteSource Insted of manual mode (which was already Done) then :
the 5 values will be retrieved from Another Table2 based on my selection of six Cascaded af:selectOneChoice , once selected , the InputText Will Populated with the 5 Values , which will be inserted in Table1 +
and insert the 5 IDS which was selected from the 5 selectOneChoice to another table Table3 which has foriegn key of Table1
So I can retrieve it later if i open the edit Screen
what is the general steps i need to follow to Fulfill this requirements ?
回答1:
In Oracle ADF when you need to update rows in 2 Database Table you have to do as follow :
- Create Entity Object based on table A
- Create Entity Object based on table B
- Create View Object based on Both Entity Object (To do so, will generate a View Object with a join between the two table. With the correct where/subqueries for your use case)
- Add the View Object containing both Entity Object to the Application Module
- Use this View Object from your datasource to create your form
When you'll commit this View Object both Entity Object will be commited and the two database tables updated. Same goes for inserts.
来源:https://stackoverflow.com/questions/56795181/how-to-insert-into-multiple-tables-in-adf