The most basic SQL query is to get a list of scalars (values) from one or more tables. Following is the syntax for using native SQL for scalar values:
String sql ="SELECT first_name, salary FROM EMPLOYEE";
SQLQuery query =session.createSQLQuery(sql); query.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP); List results =query.list(); |