For those who may have the same question, this works fine in my program :
Code:
try {
session = HibernateUtil.currentSession();
String num = "XXXX";
String sql_query = "SELECT C.Id, C.num_loc, A.Lieux FROM Circulation C, Appro_gasoil A WHERE C.num_loc = num";
@SuppressWarnings("unchecked")
Query query = session.createSQLQuery(sql_query)
.addScalar("Id", Hibernate.INTEGER)
.addScalar("num_loc", Hibernate.STRING)
.addScalar("Lieux", Hibernate.STRING);
List result = (List)query.list();
for(int i=0; i<result.size(); i++) {
Object[] ligne = (Object[])result.get(i);
System.out.println(ligne[2]);
}
} catch (HibernateException e) {
System.out.println("Erreur dans la requĂȘte concernant les approvisionnements en gasoil");
e.printStackTrace();
}