Exception caused by bind variables in ORDER BY clause and VO RANGE_PAGING
Hi,
I'm using a ViewObject in RANGE_PAGING mode and discovered a problem when using bind variables in the ORDER BY clause of my statement:
SELECT * FROM (SELECT /*+ FIRST_ROWS */ IQ.*, ROWNUM AS Z_R_N FROM (
SELECT * FROM T_TABLE WHERE (attr1 = :1) ORDER BY decode (attr2, :2, 1, null, 0, -1) desc, attr3 ) IQ
WHERE ROWNUM < :2) WHERE Z_R_N > :3 When a bind variable is used in the ORDER BY CLAUSE and the method VO.getEstimatedRowCount() is call then the DB issued an SQL error:
java.sql.SQLException: Ungültiger Spaltenindex (eng.: invalid column index)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:137)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:174)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:239)
at oracle.jdbc.driver.OraclePreparedStatement.setStringInternal(OraclePreparedStatement.java:4612)The numbering of the bind variables indicates that the last two bind variables have the wrong numbering (??)
When I rewrite the SQL into the following statement, the SQL error does not occur but I have not verified yet that the VO delivers the correct range of data because the numbering of the bind variables is not correct.
SELECT * FROM (SELECT /*+ FIRST_ROWS */ IQ.*, ROWNUM AS Z_R_N FROM (
SELECT *, decode (attr2, :1, 1, null, 0, -1) as ATTR_FOR_SORTING FROM T_TABLE WHERE (attr1 = :2) ORDER BY ATTR_FOR_SORTING desc, attr3 ) IQ
WHERE ROWNUM < :2) WHERE Z_R_N > :3I'm working with JDev 10.1.2 and Oracle DB 9203.
Any comments are welcome!
Thanks,
Markus
You are using the bind variable :2 twice. Did you try
SELECT * FROM (SELECT /*+ FIRST_ROWS */ IQ.*, ROWNUM AS Z_R_N FROM (
SELECT * FROM T_TABLE WHERE (attr1 = :1) ORDER BY decode (attr2, :2, 1, null, 0, -1) desc, attr3 ) IQ
WHERE ROWNUM < :4) WHERE Z_R_N > :3
setWhereClauseParm(0, "a"); // :1
setWhereClauseParm(1, "b"); // :2
setWhereClauseParm(2, "c"); // :3
setWhereClauseParm(3, "b"); // :2setting the fourth parameter the same as the second one?
I remeber reading something about using bind variables twice causing problems, but I#m not sure about it.
Similar Messages
-
Using bind variable in dynamic where clause and concatenate with query
Hi,
In my procedure i am framing where clause dynamically with bind variable,When i am concatenate this with my sql query for REF CURSOR i got sql command not properly ended exception.
Is it possible to pass values to the bind variable through the dynamic variable/value?
Please advise
Thanks in advance
Siva
IF in_applicationId IS NOT NULL THEN
optional_where := optional_where || ' AND a.APPLICATION_ID like '||':e%';
optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'||',in_queue_id'||',in_applicationId';
END IF;
My query is like this
open Out_Main FOR SelectQuery USING optional_usingThanks for reply,
In my procedure, i suppose to frame the where clause with bind dynamically according to the input parameters. so that i am framing the values of the bind variables also dynamically like this,
Please advise...
IF in_assignedAppFlag IS NOT NULL THEN
IF in_assignedAppFlag = 'Y' THEN
optional_where := optional_where || ' AND b.ASSIGNED_TO = :b' ;
optional_using := ' in_appFuncGroup'||',in_currentUserID';
ELSe
IF in_isSupervisor = 0 THEN
optional_where := optional_where || ' AND (b.ASSIGNED_TO = :b'||' OR b.ASSIGNED_TO = ''-1'' OR b.ASSIGNED_TO IS NULL)';
optional_using := ' in_appFuncGroup'||',in_currentUserID';
END IF;
END IF;
ELSE
IF in_isSupervisor = 0 THEN
optional_where := optional_where || ' AND (b.ASSIGNED_TO = :b'||' OR b.ASSIGNED_TO = ''-1'' OR b.ASSIGNED_TO IS NULL)';
optional_using := ' in_appFuncGroup'||',in_currentUserID';
END IF;
END IF;
IF in_appFuncGroup IS NOT NULL THEN
optional_where := optional_where || ' AND e.APP_FUNC_GROUP= :c';
optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup';
END IF;
IF in_queue_id IS NOT NULL THEN
optional_where := optional_where || ' AND b.QUEUE_ID = :d';
optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'||',in_queue_id';
END IF;
IF in_applicationId IS NOT NULL THEN
optional_where := optional_where || ' AND a.APPLICATION_ID like '||':e%';
optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'||',in_queue_id'||',in_applicationId';
END IF;
IF in_sourceCode IS NOT NULL THEN
optional_where := optional_where || ' AND e.APP_SOURCE_CODE like '||':f%';
optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
||',in_queue_id'||',in_applicationId'||',in_sourceCode';
END IF;
IF in_logo IS NOT NULL THEN
optional_where := optional_where || ' AND appProds.PRODUCT_TYPE like '||':g%';
optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo';
END IF;
IF in_firstName IS NOT NULL THEN
optional_where := optional_where || ' AND upper(a.FIRST_NAME) like upper(:h%)';
optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo'||',in_firstName';
END IF;
IF in_surName IS NOT NULL THEN
optional_where := optional_where || ' AND upper(a.SURNAME) like upper(:i%)';
optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo'||',in_firstName'||',in_surName';
END IF;
IF in_retreival_id IS NOT NULL THEN
optional_where := optional_where || ' AND e.RETREIVAL_ID like :j%';
optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo'||',in_firstName'||',in_surName'||',in_retreival_id';
END IF; -
Setting bind variable value programmatically for master and child VO's
Defined following BC:
Serv VO - Master VO, has Bind_cNum (bind variable)
ServDetail VO - Child VO, has Bind_cNum2 (bind variable)
ServViewLink VL - View link between Serv VO & ServDetail VO
in AMModule Impl have custom WS:
public List<ViewRowImpl> getMyServices(String cNum)
List<ViewRowImpl> result = new ArrayList<ViewRowImpl>();
ViewObjectImpl vo1 = getServ(); //Master VO
vo1.setNamedWhereClauseParam("Bind_cNum", cNum);
vo1.setForwardOnly(true);
ViewObjectImpl vo2 = getServDetail(); //Child VO
vo2.setNamedWhereClauseParam("Bind_cNum2", cNum);
vo1.executeQuery();
while (vo1.hasNext()) {
result.add((ViewRowImpl)vo1.next());
return result;
I am passing same cNum parameter to both Serv VO (Master VO) and ServDetail VO (child VO) as above. (this is in addition to view link bind variable :Id)
It shows in the logs that it is setting the values correctly:
<ViewRowSetImpl> <setNamedWhereClauseParam> [382] Serv ViewRowSetImpl.setNamedWhereClauseParam(Bind_cNum, 11771370)
<ViewRowSetImpl> <setNamedWhereClauseParam> [383] ServDetail ViewRowSetImpl.setNamedWhereClauseParam(Bind_cNum2, 11771370)
<ViewRowSetImpl> <doSetWhereClauseParam> [383] Serv ViewRowSetImpl.doSetWhereClause(-1, Bind_cNum, 11771370)
<ViewRowSetImpl> <execute> [385] Serv ViewRowSetImpl.execute caused params to be "un"changed
<OracleSQLBuilderImpl> <bindParamValue> [394] Binding param "Bind_cNum": 11771370
<ADFLogger> <addContextData> Execute query
-- when executing view link
<ViewRowSetImpl> <setParamValues> [425] ServViewLink_0 ViewRowSetImpl.setParamValues params changed
<ViewRowSetImpl> <doSetWhereClauseParam> [426] ServViewLink_0 ViewRowSetImpl.doSetWhereClause(-1, Bind_cNum2, null)
<ViewObjectImpl> <bindParametersForCollection> [436] For RowSet : ServViewLink_0
<OracleSQLBuilderImpl> <bindParamValue> [437] Binding null of type 12 for "Bind_cNum2"
<OracleSQLBuilderImpl> <bindParamValue> [438] Binding param "Bind_Id": 5018
from above log, when ServViewLink_0 is executed, it is changing Bind_cNum2 bind variable to null.
how can i pass same bind variable value to both Master and Child view objects from AM Impl.java
Edited by: bsrao on Oct 11, 2012 6:07 PM
Edited by: bsrao on Oct 11, 2012 6:10 PM
Edited by: bsrao on Oct 11, 2012 6:12 PMTry executing the vo1 query before setting the bind variable for vo2, then execute the vo2 query (if that's what you want to do).
-
How to use a bind variable in an IN clause
I am trying to use a bind variable in an IN clause where the column is a varchar2 type. Something like:
select *
from test
where test_column in (:bindVariable)I have tried assigning the bind variable comma separated strings (eg. test,test,test) and comma separated strings with quotes (eg. 'test','test','test'). Neither of these work. Does anyone know the correct way to do this?
Thanks in advance.http://tkyte.blogspot.com/2006/06/varying-in-lists.html
Presents many options. -
I want to remove bind variables in my data like & and many
I have a field that holds description of a code and this is having bind variables (special characters). I need to remove them and replace with no value.
I was trying with following sql and the dialog box (Enter Substitution Variable)is opening when I tried to execute the sql.
select regexp_replace('B VOC AC & HEATING (*[[:punct:]])', '') from dual;
please provide me the SQL how to do this
Thanks in advanceHi,
It looks like your question is about Substitution Variables, that typically look like &start_date or &1. Bind Variables are completely different.
By default, SQL*Plus, and some other front ends, expect that & will be followed by a substitution variable name. If you're not using substitution variables, and you want to treat & as a normal character, then use Pablolee's suggestion. SET DEFINE OFF will make SQL*Plus treat & as a normal character until you end the SQL*Plus session, or you explicitly cancel it by saying SET DEFINE ON.
By the way, did you mean to call REGEXP_REPLACE with 2 arguments, like you posted
select regexp_replace('B VOC AC & HEATING (*[[:punct:]])', '') from dual;
or with 3 arguments, something like this
select regexp_replace ( 'B VOC AC & HEATING'
, '(*[[:punct:]])' -- Round parentheses, '(' and ')', are not doing anything in this case
, '' -- NULL might be clearer
from dual;
? Also, '*' in a regular expression p
attern, means "the last item can occur 0 or more times". In your code, there isn't any "last item" before the '*', What are you trying to do? Post some sample data (CREATE TABLE and INSERT statements) for a few different sample cases, and the results you want from that sample data.
See the forum FAQ: https://forums.oracle.com/message/9362002 -
Using bind varaible for order by clause
Hello
Can some one suggest for the following scenario?
My order by clause will be constructed based on the selected fields in the form. And now the order by clause need to be passed as parameter to Excel report.
When I use Ref cursor and OPEN-FOR-USING clause, data is not sorted.
do we have any other alternate for this?
Please observe the example code for the same. Block below resembles the code for to select the data for excel report.
SQL> select * from t;
T
sdf
der
gdr
ghft
ytut
lkrt
rtrt
tyrt
SQL> declare
2 l_order_by VARCHAR2 (100);
3 l_test varchar2(10);
4 TYPE TEST IS REF CURSOR;
5 c_TEST test;
6 L_string VARCHAR2(2000):= 'select * from t order by :pi_order';
7 begin
8 l_order_by := ' t DEsc';
9 open c_test for l_string using l_order_By;
10 loop
11 fetch c_test into l_test;
12 exit when c_TEST%notfound;
13 dbms_output.put_line (l_test);
14 end loop;
15 close c_test;
16 end;
17 /
sdf
der
gdr
ghft
ytut
lkrt
rtrt
tyrt
PL/SQL procedure successfully completed.
Cheers
Ram KanalaMy order by clause will be constructed based on the selected fields in the formDoes this look like you need ?
SQL> var so number
SQL> exec :so := 1;
PL/SQL procedure successfully completed.
SQL> set serveroutput on
SQL> declare
2 rc sys_refcursor;
3 type emprec is table of emp%rowtype index by pls_integer;
4 erec emprec;
5 begin
6
7 open rc for 'select * from emp order by ' ||
8 'decode(:p,1,ename,2,deptno,3,sal,null),' ||
9 'decode(:p,4,ename,5,deptno,6,sal,null) desc' using :so,:so;
10 fetch rc bulk collect into erec;
11 close rc;
12
13 for i in 1..erec.count loop
14 dbms_output.put_line('Ename = ' || erec(i).ename || ', deptno = ' || erec(i).deptno || ', sal
= ' || erec(i).sal);
15 end loop;
16 end;
17 /
Ename = ADAMS, deptno = 20, sal = 1100
Ename = ALLEN, deptno = 30, sal = 1600
Ename = BLAKE, deptno = 30, sal = 2850
Ename = CLARK, deptno = 10, sal = 2450
Ename = FORD, deptno = 20, sal = 3000
Ename = JAMES, deptno = 30, sal = 950
Ename = JONES, deptno = 20, sal = 2975
Ename = KING, deptno = 10, sal = 5000
Ename = MARTIN, deptno = 30, sal = 1250
Ename = MILLER, deptno = 10, sal = 1300
Ename = SCOTT, deptno = 20, sal = 3000
Ename = SMITH, deptno = 20, sal = 800
Ename = TURNER, deptno = 30, sal = 1500
Ename = WARD, deptno = 30, sal = 1250
PL/SQL procedure successfully completed.
SQL> exec :so := 2
PL/SQL procedure successfully completed.
SQL> /
Ename = CLARK, deptno = 10, sal = 2450
Ename = KING, deptno = 10, sal = 5000
Ename = MILLER, deptno = 10, sal = 1300
Ename = JONES, deptno = 20, sal = 2975
Ename = FORD, deptno = 20, sal = 3000
Ename = ADAMS, deptno = 20, sal = 1100
Ename = SMITH, deptno = 20, sal = 800
Ename = SCOTT, deptno = 20, sal = 3000
Ename = WARD, deptno = 30, sal = 1250
Ename = TURNER, deptno = 30, sal = 1500
Ename = ALLEN, deptno = 30, sal = 1600
Ename = JAMES, deptno = 30, sal = 950
Ename = BLAKE, deptno = 30, sal = 2850
Ename = MARTIN, deptno = 30, sal = 1250
PL/SQL procedure successfully completed.
SQL> exec :so := 5;
PL/SQL procedure successfully completed.
SQL> /
Ename = BLAKE, deptno = 30, sal = 2850
Ename = TURNER, deptno = 30, sal = 1500
Ename = ALLEN, deptno = 30, sal = 1600
Ename = MARTIN, deptno = 30, sal = 1250
Ename = WARD, deptno = 30, sal = 1250
Ename = JAMES, deptno = 30, sal = 950
Ename = SCOTT, deptno = 20, sal = 3000
Ename = JONES, deptno = 20, sal = 2975
Ename = SMITH, deptno = 20, sal = 800
Ename = ADAMS, deptno = 20, sal = 1100
Ename = FORD, deptno = 20, sal = 3000
Ename = KING, deptno = 10, sal = 5000
Ename = MILLER, deptno = 10, sal = 1300
Ename = CLARK, deptno = 10, sal = 2450
PL/SQL procedure successfully completed.Rgds. -
How to use a lexical variable in a WHERE clause and as a function argument.
Hello,
My report has a lexical variable which has values like 'and id in (1,3,4)'. I want to use this variable in two separate queries. In the first, it is used in the WHERE clause, something like:
.. where date is not null &var;
In the second query, the variable is used in a function call, something like:
select * from table (my_function(&var));
The trouble is that the first query works when the value of the variable is unquoted, but for the second query the value should be quoted.
Does anyone have an idea how I could solve this problem?
Thanks in advance,
Frans
Message was edited by:
fransiehttp://tkyte.blogspot.com/2006/06/varying-in-lists.html
Presents many options. -
ADF VO bind variable does not work in 'OrderBy' clause
Hello, All
When trying to define a VO with a SQL query, we use VO bind variables on the 'OrderBy' clause and set Groovy expression to populate values at runtime. Based on simple experiments, ADF throws out an exception saying that "Attempt to set a parameter name that does not occur in the SQL'. I am wondering if it is allowed to use bind variables in a 'OrderBy' clause? I know it does in 'Where' clause.
Thanks a lot for your answers.
Regards,
DavidSo is there any change of the BC framework being corrected to allow this, since it is legal syntax, as in the following sql*plus example?
select last_name, decode(&&1, 'SA_REP', nvl(commission_pct,0), 'SA_MAN', nvl(commission_pct,0), nvl(salary,0))
from hr.employees
where job_id = &&1
order by decode (&&1, 'SA_REP', nvl(commission_pct,0), 'SA_MAN', nvl(commission_pct,0), nvl(salary,0))
/ -
Hi Guys
PLease i am really stuck
i have a LOV which has a complex query...
in that query there are multiple bind variables that are assigned... ie :1 , :2 and so forth
here is the query for the LOV
SELECT a.kri_description, a.kri_id
FROM xx_key_result_indicators a, xx_kri_positions b
WHERE TO_DATE (:1, 'DD-MON-YYYY') BETWEEN a.effective_from_date
AND a.effective_to_date
AND TO_DATE (:2, 'DD-MON-YYYY') BETWEEN b.effective_from_date
AND b.effective_to_date
AND a.kra_id = :3
AND a.kri_id IN (
SELECT c.kri_id
FROM xx_kri_positions c
WHERE TO_DATE (:4, 'DD-MON-YYYY')
BETWEEN c.effective_from_date
AND c.effective_to_date
AND c.position_id = :5
AND c.enable_flag = 'Y')
AND b.position_id = :6
AND a.enable_flag = 'Y'
AND b.enable_flag = 'Y'
AND a.kri_id NOT IN (SELECT NVL (g.kri_id, 1)
FROM xx_perf_kri g
WHERE g.perf_kra_id = :7)
UNION
SELECT f.kri_description, f.kri_id
FROM xx_key_result_indicators f
WHERE TO_DATE (:8, 'DD-MON-YYYY') BETWEEN f.effective_from_date
AND f.effective_to_date
AND f.kra_id = :9
AND f.kri_id NOT IN (SELECT e.kri_id
FROM xx_kri_positions e)
AND f.enable_flag = 'Y'
AND f.kri_id NOT IN (SELECT NVL (d.kri_id, 1)
FROM xx_perf_kri d
WHERE d.perf_kra_id = :10)
so in theroy when i push the tourch icon next to my text field i set these bind variables...
so in theroy that should work,,, but becuase i have a lov the framework will automatically assign extra where clause params for the filter.... and the query will look as follows
SELECT *
FROM (SELECT a.kri_description, a.kri_id
FROM xx_key_result_indicators a, xx_kri_positions b
WHERE TO_DATE (:1, 'DD-MON-YYYY') BETWEEN a.effective_from_date
AND a.effective_to_date
AND TO_DATE (:2, 'DD-MON-YYYY') BETWEEN b.effective_from_date
AND b.effective_to_date
AND a.kra_id = :3
AND a.kri_id IN (
SELECT c.kri_id
FROM xx_kri_positions c
WHERE TO_DATE (:4, 'DD-MON-YYYY')
BETWEEN c.effective_from_date
AND c.effective_to_date
AND c.position_id = :5
AND c.enable_flag = 'Y')
AND b.position_id = :6
AND a.enable_flag = 'Y'
AND b.enable_flag = 'Y'
AND a.kri_id NOT IN (SELECT NVL (g.kri_id, 1)
FROM xx_perf_kri g
WHERE g.perf_kra_id = :7)
UNION
SELECT f.kri_description, f.kri_id
FROM xx_key_result_indicators f
WHERE TO_DATE (:8, 'DD-MON-YYYY') BETWEEN f.effective_from_date
AND f.effective_to_date
AND f.kra_id = :9
AND f.kri_id NOT IN (SELECT e.kri_id
FROM xx_kri_positions e)
AND f.enable_flag = 'Y'
AND f.kri_id NOT IN (SELECT NVL (d.kri_id, 1)
FROM xx_perf_kri d
WHERE d.perf_kra_id = :10)) qrslt
WHERE (( UPPER (kri_description) LIKE :1
AND ( kri_description LIKE :2
OR kri_description LIKE :3
OR kri_description LIKE :4
OR kri_description LIKE :5
not that now there are bind variable 1 through to 10 and then 1 through to 5...
the error i am getting is not all variables bound exception..
please if anyone could help....
ThanksI am new to OA Fwk, but I am Expert of java, J2EE.
My solution will work fine in pure java.
I am sure same should work in OA also.
But I never experimented it. Give it a try
Lets take a select query:
select my_col from my_table where clo1 = :1 and col2 = :1
In this query there is only one bind varible ":1" in the world of PL/SQL.
But for there are two bind varibales you need to set them two times.
in java you will do
stmt.setString(1, myval);
stmt.setString(2, myval);
Now coming to your query.
It has 10 +5 total 15 bind variables and you need to set 15 but not 10.
For all practicle purposes assume that :1 or :2 or :3 is equivalent to ?
Thus your select query is equivalent to
SELECT *
FROM (SELECT a.kri_description, a.kri_id
FROM xx_key_result_indicators a, xx_kri_positions b
WHERE TO_DATE (?, 'DD-MON-YYYY') BETWEEN a.effective_from_date
AND a.effective_to_date
AND TO_DATE (?, 'DD-MON-YYYY') BETWEEN b.effective_from_date
AND b.effective_to_date
AND a.kra_id = ?
AND a.kri_id IN (
SELECT c.kri_id
FROM xx_kri_positions c
WHERE TO_DATE (?, 'DD-MON-YYYY')
BETWEEN c.effective_from_date
AND c.effective_to_date
AND c.position_id = ?
AND c.enable_flag = 'Y')
AND b.position_id = ?
AND a.enable_flag = 'Y'
AND b.enable_flag = 'Y'
AND a.kri_id NOT IN (SELECT NVL (g.kri_id, 1)
FROM xx_perf_kri g
WHERE g.perf_kra_id = ?)
UNION
SELECT f.kri_description, f.kri_id
FROM xx_key_result_indicators f
WHERE TO_DATE (?, 'DD-MON-YYYY') BETWEEN f.effective_from_date
AND f.effective_to_date
AND f.kra_id = ?
AND f.kri_id NOT IN (SELECT e.kri_id
FROM xx_kri_positions e)
AND f.enable_flag = 'Y'
AND f.kri_id NOT IN (SELECT NVL (d.kri_id, 1)
FROM xx_perf_kri d
WHERE d.perf_kra_id = ?)) qrslt
WHERE (( UPPER (kri_description) LIKE ?
AND ( kri_description LIKE ?
OR kri_description LIKE ?
OR kri_description LIKE ?
OR kri_description LIKE ?)))
you need to set the values in the order in which bind varibale appear in select query -
How execute a dynamic statement with a variable number of bind variables
Hi all.
I would like to execute SQL statements in a PL/SQL function.
SQL statements must use bind variable in order to avoid parsing time. But the number of arguments depends on the context. I can have from 10 to several hundreds of arguments (these arguments are used in a 'IN' clause).
To minimise the number of differents signature (each new signature involve a parsing), the number of argument is rounded.
My problem is : how to set dynamicaly the bind variables ?
Cause it is pretty simple to construct dynamicaly the SQL statement, but using an
" OPEN .... USING var1, var2, ..., varX "
statement, it is not possible to handle a variable nomber of bind variable.
I am looking for the best way to do the same thing that it can be done in java/JDBC with the PreparedStatement.setObject(int parameterIndex, Object x).
I saw the dbms_sql package and bond_variable procedure : is a the good way to do such a thing ?
ThanksIf the variation is only values in an IN list, I would suggest using an object type for the bind variable. This lets you have just one bind variable, regardless of how many values are in the IN list.
The dynamic SQL ends up looking like:
' ... where c in (select * from table(:mylist))' using v_list;where v_list is a collection based on a SQL user-defined type that can be populated incrementally, or in one shot from a delimited list of values using a helper function.
I use this approach all the time in dynamic searches.
See this link for more details:
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:110612348061 -
Problems with Date bind variable
I'm trying to use a Date as a bind variable in a View Object, and I'm running into difficulties. I've got the bind variable type set to date, and the control hints for Format Type and Format set to "Simple Date" and "yyyy-MM-dd" respectively. When I run the application module test and enter the date in the correct format, the View Object returns the expected results. However, when I try to set a Query Bind Parameters property for a JHeadstart group in my application definition in order to set the bind variable's value from an dateField input control, I get the following exception:
30-Jan 08:49:56 ERROR (ErrorReportingUtils) -java.lang.IllegalArgumentException
at java.sql.Date.valueOf(Date.java:104)
at oracle.jbo.domain.Date.toDate(Date.java:348)
at oracle.jbo.domain.Date.<init>(Date.java:279)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at oracle.jbo.domain.TypeConvMapEntry.convert(TypeConvMapEntry.java:73)
at oracle.jbo.domain.TypeFactory.get(TypeFactory.java:739)
at oracle.jbo.domain.TypeFactory.getInstance(TypeFactory.java:90)
at oracle.jbo.common.VariableImpl.convertToJava(VariableImpl.java:546)
at oracle.jbo.common.VariableValueManagerImpl.doSetVariableValue(VariableValueManagerImpl.java:182)
at oracle.jbo.common.VariableValueManagerImpl.setVariableValue(VariableValueManagerImpl.java:223)
at oracle.jbo.common.VariableValueManagerImpl.setVariableValue(VariableValueManagerImpl.java:229)
at oracle.jheadstart.model.adfbc.v2.JhsApplicationModuleImpl.applyBindParams(JhsApplicationModuleImpl.java:173)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at oracle.adf.model.binding.DCInvokeMethod.invokeMethod(DCInvokeMethod.java:507)
at oracle.adf.model.binding.DCDataControl.invokeMethod(DCDataControl.java:1795)
at oracle.adf.model.bc4j.DCJboDataControl.invokeMethod(DCJboDataControl.java:1989)
at oracle.adf.model.binding.DCInvokeMethod.callMethod(DCInvokeMethod.java:219)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1289)
at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:1802)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:627)
at oracle.adf.model.binding.DCInvokeActionDef$DCInvokeAction.refresh(DCInvokeActionDef.java:140)
at oracle.adf.model.binding.DCBindingContainer.internalRefreshControl(DCBindingContainer.java:2521)
at oracle.adf.model.binding.DCBindingContainer.refresh(DCBindingContainer.java:2260)
at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.prepareRender(PageLifecycleImpl.java:534)
at oracle.adf.controller.faces.lifecycle.FacesPageLifecycle.prepareRender(FacesPageLifecycle.java:98)
at oracle.jheadstart.controller.jsf.lifecycle.JhsPageLifecycle.prepareRender(JhsPageLifecycle.java:1155)
at oracle.adf.controller.v2.lifecycle.Lifecycle$1.execute(Lifecycle.java:297)
at oracle.adf.controller.v2.lifecycle.Lifecycle.executePhase(Lifecycle.java:116)
at oracle.adf.controller.faces.lifecycle.ADFPhaseListener.mav$executePhase(ADFPhaseListener.java:29)
at oracle.adf.controller.faces.lifecycle.ADFPhaseListener$1.before(ADFPhaseListener.java:426)
at oracle.adf.controller.faces.lifecycle.ADFPhaseListener.beforePhase(ADFPhaseListener.java:77)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:228)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:162)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:228)
at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:197)
at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:123)
at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:103)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
However, it seems that the value of the bind parameter did in fact change, according to the debug message issued by the JhsApplicationModuleImpl.applyBindParams(...) procedure:
30-Jan 08:46:23 DEBUG (JhsApplicationModuleImpl) -ViewObject ViewObj: value of bind param move_date has changed: old value=null ,new value=Wed Jan 07 00:00:00 CST 2009
One thing I have noticed that may be of interest - if I run the debugger into the JhsApplicationModuleImpl.applyBindParams(...) procedure, a default date in my bind variable shows up as an oracle.jbo.domain.Date object when it comes out of the following line:
Object oldValue = vo.ensureVariableManager().getVariableValue(key);
as opposed to the new value that gets sent from the input value of the dateField control, which shows up as a java.util.Date in the following line:
Object value = args.get(key);
In the string of functions leading up to the following in the stack trace:
at java.sql.Date.valueOf(Date.java:104)
at oracle.jbo.domain.Date.toDate(Date.java:348)
at oracle.jbo.domain.Date.<init>(Date.java:279)
it looks like the value of the java.util.Date is converted to a string, then passed to these functions to be turned into a java.sql.Date object. However, according to the java.sql.Date.valueOf(...) function, it's expecting date in "yyyy-mm-dd" format, per the header comments:
* Converts a string in JDBC date escape format to
* a <code>Date</code> value.
* @param s a <code>String</code> object representing a date in
* in the format "yyyy-mm-dd"
* @return a <code>java.sql.Date</code> object representing the
* given date
* @throws IllegalArgumentException if the date given is not in the
* JDBC date escape format (yyyy-mm-dd)
When the input value from the dateField input control is added as a java.util.Date, the toString() is producing the wrong date format, which could be seen in the debug output I included above that said the bind variable has changed.
Has anyone done this before that can let me know what I am missing and how to fix this? I've search all over the web, and all the articles I've seen relating to bind variables only refer to those of numeric or string types, which aren't giving me any trouble. Even the Developer's Guide (http://database.in2p3.fr/doc/oracle/Oracle_Application_Server_10_Release_3/web.1013/b25947/bcquerying009.htm) article "5.9 Using Named Bind Variables" doesn't reference using a Date type.I had the same problem about a year ago (using JHeadstart 10.1.3.2.52):
15-feb 14:10:31 DEBUG (JhsApplicationModuleImpl) -Search item matches query bind param SubjectenKernPeildatum, value set to 2000-01-01
15-feb 14:10:33 DEBUG (JhsApplicationModuleImpl) -Executing applyBindParams for BasServiceKern.AdresRollenSubjecten
15-feb 14:10:33 DEBUG (JhsApplicationModuleImpl) -ViewObject AdresRollenSubjecten: value of bind param peildatum has changed: old value=null ,new value=Sat Jan 01 00:00:00 CET 2000
15-feb 14:10:33 ERROR (ErrorReportingUtils) -java.lang.IllegalArgumentException
at java.sql.Date.valueOf(Date.java:104)
at oracle.jbo.domain.Date.toDate(Date.java:348)
It appears a java.util.Date gets put on the criteria Map in the searchBean, this can't be used as input for a jbo.Date bindvariable.
My ugly solution was to override public void applyBindParams(String voUsage,HashMap args)
in MyProjectApplicationModuleImp (which extends JhsApplicationModuleImpl of course),
check if value is a java.util.Date, and then
value = new java.sql.Date(((java.util.Date)value).getTime());
Greetings, HJ
Edited by: HJHorst on Feb 6, 2009 12:22 AM -
I get the exception when using bind variables in the VO (sql-based).
VO is based on the SQL query from the pipelined table function, for instance: select * from table(some_function(:bind1, :bind2)). This query returns a table, which I want to display on the separate page.
So, from fragmented bounded task flow make a call for the new taskflow (non-fragmented, bounded) in the dialog window. Specify the input parameters for the called taskflow. These parameters I get in called taskflow, it is ok. The very first activity in the called taskflow is the ExecuteWithParams method. I bind input parameters from the pageFlowScope to the ExecuteWithParams parameters, but IN PL/SQL FUNCTION (and ADF log) I SEE, THAT THESE PARAMETERS IS NULL, BUT ONLY FOR THE FIRST TIME THE EXECUTEWITHPARAMS IS CALLED.
StackTrace is tje following:
[2555] ViewObject: <MyVO> close single-use prepared statements
[2556] QueryCollection.executeQuery failed...
[2557] java.sql.SQLException: ORA-20106: <custom exception>
ORA-06512: on "some_function", line xx
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:116)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:177)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:785)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:860)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1186)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3381)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3425)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1490)
at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:1040)
at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:762)
at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:5681)
at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:1005)
at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:1162)
at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:1082)
at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:1076)
at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:5601)
at oracle.adf.model.bc4j.DCJboDataControl.executeIteratorBindingIfNeeded(DCJboDataControl.java:1358)
at oracle.adf.model.binding.DCIteratorBinding.executeQueryIfNeeded(DCIteratorBinding.java:2098)
at oracle.adf.model.binding.DCBindingContainer.internalRefreshControl(DCBindingContainer.java:2943)
at oracle.adf.model.binding.DCBindingContainer.refreshControl(DCBindingContainer.java:2671)
at oracle.adf.model.binding.DCBindingContainer.refresh(DCBindingContainer.java:2657)
at oracle.adfinternal.controller.binding.DataBindingActivity.beforeExecute(DataBindingActivity.java:89)
at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:812)
at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:718)
at oracle.adfinternal.controller.engine.ControlFlowEngine.invokeDialogTaskFlow(ControlFlowEngine.java:278)
at oracle.adfinternal.controller.application.DialogRequestHandler.invokeDialogTaskFlow(DialogRequestHandler.java:83)
at oracle.adfinternal.controller.application.DialogRequestHandler.doCreateView(DialogRequestHandler.java:52)
at oracle.adfinternal.controller.application.BaseRequestHandlerImpl.createView(BaseRequestHandlerImpl.java:55)
at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.createView(ViewHandlerImpl.java:90)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._restoreView(LifecycleImpl.java:524)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:250)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:175)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:181)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:279)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:239)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:196)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:139)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at oracle.security.jps.wls.JpsWlsFilter$1.run(JpsWlsFilter.java:85)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:257)
at oracle.security.jps.wls.JpsWlsSubjectResolver.runJaasMode(JpsWlsSubjectResolver.java:250)
at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:100)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:65)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
[2558] <MyVO>>#q old SQLStmtBufLen: 327, actual=297, storing=327
[2559] select * from table(some_function(:bind1, :bind2))
[2560] **** PoolMessage REQ ATTACH LWS
[2561] **** PoolMessage REQ DETACH LWS
Root cause of ServletException.
oracle.jbo.SQLStmtException: JBO-27122: _____ select * from table(some_function(:bind1, :bind2)))
at oracle.jbo.server.BaseSQLBuilderImpl.processException(BaseSQLBuilderImpl.java:3837)
at oracle.jbo.server.OracleSQLBuilderImpl.processException(OracleSQLBuilderImpl.java:4621)
at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:1150)
at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:762)
at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:5681)
Truncated. see log file for complete stacktrace
java.sql.SQLException: ORA-20106: <CustomException>
ORA-06512: on "some_function", line xxx
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:116)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:177)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
Truncated. see log file for complete stacktrace
Edited by: user593059 on 06.07.2009 7:02
Edited by: user593059 on 06.07.2009 7:02Hi,
Just made a simple use case at the model level and when I test the AM, it works. So problem is in view - task flows part. can you provide more info to reproduce also this task-flows part?
regards,
Branislav -
ManagedBean and Bind Variables in ADF applications
Situation with Target Unreachable, 'TestBean'.
ManagedBean: TestBean, parameter objectId
ViewObject: sql-based: select * from someobject where id = :objectId
Unbounded taskflow with the one page: Start.jspx
Bounded TaskFlow "TestTaskFlow" with pagefragments: ButtonView.jsff and ObjectCard.jspx (as dialog).
On the ButtonView there is a button with: action="dialog:OBJECT", actionListener.
ActionListener handler I create by using the JDev Wizard. And the record was appeared in the adfc-config.xml. Is it correct? since the button is in the Taskflow. So in the taskflow there is no records about managed beans. May be it is Ok.
Than, on the ObjectCard.jspx add ExecuteWithParams VO method, and set bind variable from the managedbean attribute. and get an error:
SEVERE: Server Exception during PPR, #1
javax.servlet.ServletException: Target Unreachable, 'TestBean' returned null
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:270)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:181)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:279)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:239)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:196)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:139)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:102)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:65)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: javax.faces.el.EvaluationException: Target Unreachable, 'TestBean' returned null
at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:58)
at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1227)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:142)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:754)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:282)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:175)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
... 27 more
Than I add this managedbean in the Taskflow too. There is no exception, but bind variables has not been set.Hi,
most likely the managed bean got created in the adfc-config.xml file. If then it has a scope of pageFlowsScope, then it cannot be found. Move the managed bean or use it with a scope of requestScope or backingBeanScope
Frank -
Detail view with bind variable. TreeTable not showing all detail result.
I’m having trouble with treeTable using detail view with bind variables and where clause defined in VO definition.
Both, master and detail view objects, base on the same entity and have the same condition in where clause. The view objects also have bind variables, which are set in prepareRowSetForQuery() method.
Again, these are two different views, that get different result, based on value of one of the bind variable.
When I show results in two different tables on jsf page, where master table has "RowSelection" set on "single", all results are displayed in detail table.
But when I use treeTable, only the first result of the detail is shown.I tested it in applicationModule and it works, but i think that's the same as two tables on a jsf page.
This is the order in which overridden methods are called in ADF BC or two tables on jsf page
when clicking on row in master table.
PrepareRowSetForQueryDetail
executeQueryForCollection_Detail user param: 2
Object 2: class [Ljava.lang.Object; -> print of the object2[] parameter in executeQueryForCollection
List 0: Bind_ChildId -> viewLink parameter
List 1: 400035313 -> viewLink parameter value
getEstimatedRowCount_Detail
count: 2
getEstimatedRowCount_Detail
count: 2 And when i click on "expand node" in tree table:
getEstimatedRowCount_Root
count: 2
PrepareRowSetForQuery_Detail
executeQueryForCollection_Detail user param: 2
Object 2: class [Ljava.lang.Object;
List 0: Bind_ChildId -> viewLink parameter
List 1: 400035321
PrepareRowSetForQueryDetail
executeQueryForCollection_Detail user param: 2
Object 2: class [Ljava.lang.Object;
List 0: Bind_ChildId -> viewLink parameter
List 1: 400035313
getEstimatedRowCount_Root
count: 2
getEstimatedRowCount_Root
count: 2
getEstimatedRowCount_Root
count: 2
PrepareRowSetForQueryDetail
executeQueryForCollection_Detail user param: 2
Object 2: class [Ljava.lang.Object;
List 0: Bind_ChildId -> viewLink parameter
List 1: 400035313
PrepareRowSetForQueryDetail
executeQueryForCollection_Detail user param: 2
Object 2: class [Ljava.lang.Object;
List 0: Bind_ChildId -> viewLink parameter
List 1: 400035321
getEstimatedRowCount_Root
count: 2
getEstimatedRowCount_Root
count: 2Values of user parameters are OK. Is there another method that i should override?
I also noticed, that if detail view doesn't have user bind variables, the tree works fine and is shown even in ADF BC (aplication module).
I guess we loose a tree, when using bind variables in detail view object.
Is there a way around it? -
Dynamic view object loses bind variables after passivation
I am creating a view object definition/view object programmatically in Jdev 11.1.1.2.0. The query requires a named bind parameter. All was working fine but now I am testing with app module pooling disabled and the bind variable is not being restored after passivation -- it's like the definition has disappeared or something.
Here is my VO creation code:
ViewObject vo = findViewObject("FinalistsWithEvalDataVO");
if (vo != null){
vo.remove();
ViewDefImpl voDef = new ViewDefImpl("FinalistsWithEvalDataVODef");
// I add a bunch of viewAttrs here...
voDef.setQuery(fullQuery);
voDef.setFullSql(true);
voDef.setBindingStyle(SQLBuilder.BINDING_STYLE_ORACLE_NAME);
voDef.resolveDefObject();
voDef.registerDefObject();
vo = createViewObject("FinalistsWithEvalDataVO", voDef);
vo.defineNamedWhereClauseParam("Bind_SchlrAyId", null, new int[] {0});
vo.setNamedWhereClauseParam("Bind_SchlrAyId", new Number(1)); //For testing
vo.executeQuery();
The query executes fine right there and then the VO seems to passivate fine. I even see the bind var in passivation:
<exArgs count="1">
<arg name="Bind_SchlrAyId" type="oracle.jbo.domain.Number">
<![CDATA[1]]>
</arg>
</exArgs>
But then when it reactivates prior to rendering the page, it invariably throws a missing parameter exception and this in the log:
<ViewUsageHelper><createViewAttributeDefImpls> [7409] *** createViewAttributeDefImpls: oracle.jdbc.driver.OraclePreparedStatementWrapper@1af78e1
<ViewUsageHelper><createViewAttributeDefImpls> [7410] Bind params for ViewObject: [FinalistsWithEvalDataVO]AwardViewingServiceAM.FinalistsWithEvalDataVO
<ViewUsageHelper><createViewAttributeDefImpls> [7411] ViewUsageHelper.createViewAttributeDefImpls failed...
<ViewUsageHelper><createViewAttributeDefImpls> [7412] java.sql.SQLException: Missing IN or OUT parameter at index:: 1
I have worked on this for hours and can't see anything wrong. Like I said, it works fine when not forcing passivation...
Any help would be appreciated.
Thanks.
-Ed@Jobinesh - Thanks for the suggestions. I have read all the documentation I can find. Everything works fine without passivation. Everything still breaks with passivation. I have given up on trying to get the bind variable to restore after passivation and am currently just building the query with all values embedded in the query rather than bind variables. This is bad practice but avoids the problem. However, now that I avoided that obstacle, I'm on to the next issue with passivation of this dynamic view object, which is that the current row primary key apparently cannot be reset after activation. I get the following error:
<Key><parseBytes> [7244] Key(String, AttributeDef[]): Invalid Key String found. AttributeCount:1 does not match Key attributes
<DCBindingContainer><reportException> [7254] oracle.jbo.InvalidParamException: JBO-25006: Value 00010000000A30303033383133343734 passed as parameter String to method Constructor:Key is invalid: {3}.
at oracle.jbo.Key.parseBytes(Key.java:537)
at oracle.jbo.Key.<init>(Key.java:179)
at oracle.jbo.server.IteratorStateHolder.getCurrentRowKey(IteratorStateHolder.java:34)
at oracle.jbo.server.ViewRowSetIteratorImpl.activateIteratorState(ViewRowSetIteratorImpl.java:3877)
I've been trying various workarounds for over a day now with no luck. Very frustrating.
Thanks for trying to help.
-Ed
Maybe you are looking for
-
Bitlocker issue in win 8.1
I decrypted my hard drive and encrypted it but not able to set up a password I only get the option to clear TPM which asks for a password that I never set up before- any help please?
-
VPRS Condition is missing in invoice for bacth determine line item
Hi Gurus, I have an Concern, My user has created Sales order with three line items. He did delivery and Invoice individually for each line item. For 2 line items he entered batch manually and did invoice there we didn't find any issue. For third line
-
ITunes adding music from external drive to multiple users
Here's what I have: My iMac currently has 3 different user accounts on it. My iTunes library is currently stored on my external HD and its location is set to route to the external drive on both accounts. I currently have both boxes checked to Keep fi
-
List/Menu Form hides Main nav dropdown
I've created an html page that when you scroll over the main nav bar at the top, the drop down, or 2nd level headers, drop down 'behind' a list/menu form? Any ideas on how to fix this?
-
User has no privileges on the schema when entering SQL Workshop
I installed Oracle Apex 4.0 and created a workspace in a new schema called APEX_TEST. Later on I reassigned the workspace to the existing schema TEST and then when an admin or developer user clicks on the SQL Workshop button this error appears : Help