Creating a Java Bean Interface for a JDBC Connection
The JdbcBean.java class fetches a list of Employee
objects.
Class Name:
src/main/java/com/oracle/jdbc/samples/bean/JdbcBean.java
Github Location: JdbcBean.java
Steps to create JdbcBean.java:
- Declare the package for the class
JdbcBean.java.package com.oracle.jdbc.samples.bean; - Import
Employeeentity class as it contains the employee details.import com.oracle.jdbc.samples.entity.Employee; - Declare an interface
EmployeeBeanclass. Inside theEmployeeBeanclass, declare a methodgetEmployees()that returns a list ofEmployeeobjects. Similarly, you learn to declare the methodsgetEmployee(int),updateEmployee(int),getEmployeeByFn(String)andincrementSalary(int)for other functionalities in the next few chapters.public interface EmployeeBean { public List<Employee> getEmployees(); }