Hello.
I need to have an updatable set of data coming form pipelined function query.
Example:
SELECT MyFunc.ID_FUNC,
MyFunc.NAME
FROM table(cast(my_package.get_my_func(:Bind_IdFunc) as my_func_t)) MyFunc
The function queries data from some MyTable table adding some programmatic logic. User doesn't have access to MyTable directly.
It is not possible to create database view and use it as EO base because of parameter.
Parameter is dynamic, defined on runtime and can't be set statically.
I need to let user modify data in such data set like in an ordinary table.
I see two variants.
1. The first is rather tricky.
I can create Entity Object setting Existing Object to false and Schema Object to "table(cast(my_package.get_my_func(:Bind_IdFunc) as my_func_t))".
http://i.imgur.com/vNQPY6P.png
Add attributes manually.
Tricky part is that any SQL query called directly by MyFuncEO would cause ORA exception as EO doesn't know parameter value.
That's why in MyFuncEOImpl java class I would need to override 2 methods:
- comment out lock();
- modify doDML to call some PL functions.
Don't need create and delete functionality, only modify existing data.
Then I can create an updatable View Object based on this EO, that would set parameter value, and work with it like with ordinary updatable VO.
Some preliminary tests show that this might work.
2. Less complex variant.
Create readonly View Object based on specified query and a pair of default EO+VO based on MyTable.
Then show ReadonlyVO on page, make it look updatable and use it to find MyTableVO row and set its value.
// page.jspx
<af:iterator value="#{bindings.ReadonlyVO1Iterator.collectionModel}" var="row">
<af:inputText value="#{viewScope.bean.name}" />
</af:iterator>
// ----------------
// PageViewscopeBean.java
// methods required to make inputText editable
public String getName() {
return (String)JSUtils.resolveExpression("#{row.Name}");
}
public void setName(String name) {
// call MyTableVO method through page bindings
updateName(JSUtils.resolveExpression("#{row.IdFunc}"), JSUtils.resolveExpression("#{row.Name}") );
// type cast omitted
}
// ----------------
// MyTableVOImpl.java
public void updateName(Integer myTableId, String name) {
// find row with myTableId key
// set row.Name value to name
}
I would like to hear recommendations on implementing such functionality.
Thanks.
ADF 11.1.2.3/12.1.3