Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Access Data from Database in Bean

ChristianM0147Feb 16 2022

Hello fellow programmers.
Im currently on the JDeveloper Version 12.2.1.4.0.
Can somebody please explain me how to access data from the Database in a bean?
I have an Application with 2 Components. An af:inputText and af:selectOneChoice. The af:inputText has an valueChangeListener that triggers a Method in a backing Bean with request scope. The af:inputText has also a binding to that bean.
I want to access my Database table with the value given in the af:inputText in the valueChangeListener Method. I already created the EntityObject and ViewObject for that table and I know how to access the value inserted in the af:inputText but i dont know how to access the ViewObject/EntityObject in the bean.
I want something like: "Select city from citys where postcode = af:inputText". With that Data i want to populate the af:selectOneChoice Component.
What needs to be considered is, that postcode is not the primary Key so methods like findByKey wont work.
Can i make this using EntityObjects/ViewObjects or do i need to manually open a Database Connection, create a Statement and execute the Query that way?
What is the ADF way to do it?

Comments

Post Details

Added on Feb 16 2022
4 comments
266 views