I want to know which query style is better & efficient
I am using jdbc to fetch data from multiple tables(I am having more than 10 tables to fetch data). All data are related with keys
for that I am considering two ways
1) I am using joins to fetch data from database
Query s="select a.*,b.*,c.*......";//fetchin all data using joins in single query
Preparedstatement ps = con.prepareStatement(query);//con is a connection object
ResultSet res = ps.executeQuery();
//fetching data from resultset res
con.close();
2)I am taking data from each individual table
Query s="select from table a";
Preparedstatement ps = con.prepareStatement(s);
ResultSet res = ps.executeQuery();
//fetching data from resultset res
Query s1="select from table b";
Preparedstatement ps1 = con.prepareStatement(s1);
ResultSet res1 = ps1.executeQuery();
//fetching data from resultset res1
.............
//continue for all remaining tables
con.close();
I would like to know if there is any other/better method to it.
EDIT: I am using very large amount of data. What about hibernet other methods