Greetings everyone!
I use JDeveloper version 11.1.2.3.0
I am currently trying to get some filtered data from a VO, based on a WHERE clause with a bind variable. This process should be done on page load. I have to set this bind variable with the id of the logged user (the part of getting this id is already achieved and used somewhere else). My current approach is defining a managed bean with pageFlow scope. Inside this i have a method in which i retrieve the id and i set it as the parameter value. The code snippet:
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("getUserIdFromUsername"); //getUserIdFromUsername is a method defined in the AppModule and exposed in the client interface
operationBinding.getParamsMap().put("username", getUserName());
Object userID = operationBinding.execute();
setUserId(Integer.parseInt(userID.toString()));
System.out.println("THE USER ID IS: "+getUserId());
BindingContainer bindings2 = getBindings();
OperationBinding operationBinding2 = bindings.getOperationBinding("ExecuteWithParams"); // i've dragged and dropped the ExecuteWithParams operation into the page
operationBinding2.getParamsMap().put("userId", getUserId()); // userId is the bind variable which i'm talking about
Object result = operationBinding2.execute();
Then, i call this method on BeforePhase in the page view. It works, i get the filtered data and the println shows me the correct ID. The problem is that each time i select a row in the table showing the data, the page seems to reload and it always get the selection back at the very first row.
What am i doing wrong? May be this is not the right approach, as i've seen some other posts about this topic but they are not very clear to me.
Please advice