
<--bean class-->method calllist is of object type
List <Object> o=bss.totalList(i);
<--service class--> public List (object type) <Object> totalList(int pi){
try{
Query q= em.createQuery("select p,c,b from Book b ,Customer c , Purchage p where c.uid=p.customer.uid and p.book.bid=b.bid and p.pid=:pid") .setParameter("pid", pi);
return q.getResultList();
}catch(Exception e){
return null;
}
how to type cast object type to entity type .

public List dataList(){
ArrayList list=new ArrayList();
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from employee");
while(rs.next()){
list.add(rs.getString("name"));
list.add(rs.getString("address"));
list.add(rs.getString("contactNo"));
list.add(rs.getString("email"));
}
}
catch(Exception e){}
return list;
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.