Sometimes you may need to use stored procedures/functions to read/write data from underlying tables. You can still leverage the benefits of ADF persistence layer by smartly wrapping the stored procedures using ViewObjects and EnityObjects.
I’m sharing a sample ADF BC application that uses stored procedures for reading and writing to the table.
Solution is simple and straight forward...
1. Create an EntityObject and override the below methods
38.5 Basing an Entity Object on a PL/SQL Package API
2. Define a ViewObject based on the above EntityObject. Override the below 'life cycle methods' to inject your custom code(for populating data form a REF CURSOR).
Please refer the below topic in Fusion Developer's Guide to learn more…
39.8 Using Programmatic View Objects for Alternative Data Sources
You can download the sample workspace from here.
[Runs with Oracle JDeveloper 11g R1 PS1]
PS: Unzip the attachment and run the script(StoredProcedureExample/script) to set up the required DB objects for running this demo
Learn More ...
There are a lot more points like this. If you are curious to learn the internals of the ADF Business Components and ADF Binding Layer, the following book is for you - Oracle ADF Real World Developer’s Guide.
More details about this book can be found in this post- http://jobinesh.blogspot.in/2012/07/pre-order-your-copy-of-oracle-adf-real.html
I’m sharing a sample ADF BC application that uses stored procedures for reading and writing to the table.
Solution is simple and straight forward...
1. Create an EntityObject and override the below methods
protected void doSelect(boolean lock)
protected void doDML(int operation, TransactionEvent e)
Please refer the below topic in Fusion Developer's Guide to learn more …38.5 Basing an Entity Object on a PL/SQL Package API
2. Define a ViewObject based on the above EntityObject. Override the below 'life cycle methods' to inject your custom code(for populating data form a REF CURSOR).
protected void create()
protected void executeQueryForCollection(Object qc, Object[] params, int numUserParams)
protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet rs)
protected boolean hasNextForCollection(Object qc)
protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet rs)
protected void releaseUserDataForCollection(Object qc, Object rs)
Please refer the below topic in Fusion Developer's Guide to learn more…
39.8 Using Programmatic View Objects for Alternative Data Sources
You can download the sample workspace from here.
[Runs with Oracle JDeveloper 11g R1 PS1]
PS: Unzip the attachment and run the script(StoredProcedureExample/script) to set up the required DB objects for running this demo
Learn More ...
There are a lot more points like this. If you are curious to learn the internals of the ADF Business Components and ADF Binding Layer, the following book is for you - Oracle ADF Real World Developer’s Guide.
More details about this book can be found in this post- http://jobinesh.blogspot.in/2012/07/pre-order-your-copy-of-oracle-adf-real.html