Embedding custom Queries into Session EJB 3.0 based on Toplink  POJOs in JDeveloper 10.1.3 environment.
1. Create application workspace HRApps with Struts,JSP,ADF template.
2. Generate Toplink Mapping for project Model and  two pojos 
Employees.java and Departments.java for offline tables   hr.employees,hr.departments.
3.Implement  "Serializable"  for both of created objects as follows:-
Public class Employees implements java.io.Serializable {
}
. . .
Public class Departments implements java.io.Serializable {
}
. . .
  
4. Invoke wizard for session EJB 3.0 creation.

 Select Toplink POJOs.

Generate all default methods suggested:

Select Remote and Local interface.
Otherwise you won't be able to create "New Sample Java Client" 
when working with remote Oracle Database. 

Right click on HRSessionBean and select  "Create Data Control" 
5.Add  to HRSessionBean.java:-
public ListfindEmpInfo(String jobId) { 
Session session = getSessionFactory().acquireSession();
Expression exp = new ExpressionBuilder().get("jobId").equal(jobId);
Listresults =(List ) session.readAllObjects ( Employees.class,exp); 
session.release();
return results;
}
Switch to  Structure Window;-
Right click on  "findEmpInfo"  node.Select Properties and select remote and local interface.
Recreate Data Control for HRSessionBean.
Create new sample Java Client and add right after 
// hRSession.findEmpInfo(  jobId ) to HRSessionClient.Java; 
String custJobid = new String("IT_PROG");
java.util.Listemps = hRSession.findEmpInfo(custJobid); 
for (Employees emp : emps) {
System.out.println(emp.getEmployeeId()+ ":" + emp.getJobId() + ": " + emp.getLastName());
}






