Hi.
Here is my problem:
I have master detail views connected with a view link. Both of views have bind variables that hold some session info:
It's a menu on database and I am trying to hide some values based on user permissions.
When running application module, everything works fine. The problem occurs when I try to show menu as a tree table, or any other table, on a page.
The root view executes fine, but then I get an
"java.sql.SQLSyntaxErrorException: ORA-00932: inconsistent datatypes: expected - got CHAR"
error in executeQueryForCollection method of detail view. (this method is overridden)
Bind Variables are:
- :menuRoot -> which holds value of Root node. (In detail view it's just a dummy variable. It is explaned later on why i used it.)
- :listOfUserPermmission -> array of user permissions.
My query looks like this:
1.Master View:
SELECT MetVMenu.CHILD_ID,
MetVMenu.CHILD_IME_MODULA,
MetVMenu.PARENT_ID,
MetVMenu.PARENT_IME_MODULA,
MetVMenu.ZST,
MetVMenu.NIVO,
MetVMenu.CHILD_NAZIV_V_MENIJU,
MetVMenu.CHILD_TIP_MODULA,
MetVMenu.CHILD_OPIS_MODULA
FROM MET_V_MENU MetVMenu
WHERE MetVMenu.PARENT_IME_MODULA like :menuRoot
and MetVMenu.CHILD_IME_MODULA in (SELECT * FROM TABLE(CAST(:listOfUserPermission AS STRARRAY)))
CHILD_IME_MODULA and PARENT_IME_MODULA are also names of permissions.
2.View Link that connects master.CHILD_ID and detail PARENT_ID
3.Detail view, that then links to itself... to get the tree menu.
SELECT MetVMenu.CHILD_ID,
MetVMenu.CHILD_IME_MODULA,
MetVMenu.PARENT_ID,
MetVMenu.PARENT_IME_MODULA,
MetVMenu.ZST,
MetVMenu.NIVO,
MetVMenu.CHILD_NAZIV_V_MENIJU,
MetVMenu.CHILD_TIP_MODULA,
MetVMenu.CHILD_OPIS_MODULA
FROM MET_V_MENU MetVMenu
WHERE :menuRoot like 'a'
and
MetVMenu.CHILD_IME_MODULA in (SELECT * FROM TABLE(CAST(:listOfUserPermission AS STRARRAY)))
4. ViewLink that connects CHILD_ID and PARENT_ID of this "detail" view.
Both views executeQuery methods are overridden to set Bind variables before execution.
I get an arrayList of strings (permissions) from session and then convert it to Array.
ArrayList permmissionsArray = (ArrayList)MyUserSession.getSessionValue("permissions");
Array permissions = new Array(permissionsArray.toArray());
HashMap context = new HashMap();
context.put(DomainContext.ELEMENT_SQL_NAME, "STRARRAY");
context.put(DomainContext.ELEMENT_TYPE, String.class);
if(permissions != null){
permissions.setContext(null, null, context);
setlistOfUserPermission(permissions);
}
//Here I set menuRoot variable.
I also noticed that there are problems with how I define bind variables (the order matters).
So when i didn't use menuRoot variable in detail view I got the
“inconsistent datatypes: expected - got CHAR"
error in application module.