Create EO based on your DB table.
Create vo from this EO
Go to expert mode and modify the query
to something like:
To full name add LOV that in the return item populated the user_id field
Drop the VO on the page
Now when you create the new row, user will choose the "full name" lov which will populate "user_id" field.
you are done
. I have tried these two approaches to get the solution:
- Generate a calculated attribute in the ViewObject, and try to invoke the DB function: obviosly, if this was possible, I did something wrong, because it didn't work. If something like this was possible, it would be the best solution.
Did you follow this: http://docs.oracle.com/cd/E28280_01/web.1111/b31974/bcquerying.htm#CHDHJHBI
What you mean by "it didn't work"? Is there any error?
Another approach is to change query mode from normal to expert and directly add new column to sql query, but in this case you will need to manually synchronize attribute list and sql query every time when you modify columns in your view object(for example, when you add new column to table)
DB View: This works, but I can't commit data in this application window.
Event that is possible, but you need to define "instead of" trigger in db and modify lock() method in EntityImpl class, so this is overkill for your usecase.
Michael, Dario, thank you both for your answers.
The final steps to get the solution are:
- Go to expert mode and modify the query
- Edit attribute and add a dependency to user_id, so if user_id changes, recalculate the new attribute.
When inserting a new row, Commit is required and then, refresh the contents.
Maybe, next question is for another thread, but, how can I do an isolated transaction (commit) programmatically?
Required Commit raises this question for me. I have different popups; each one does different things in different tables.
The scenario is:
- Popup 1 refers to DB Table 1. User changes data, but then cancel.
- Popup 2 refers to DB Table 2. User changes data, and then accept them (click OK).
I only want to Commit to DB changes made in Popup 2.
Thanks again. Regards