hibernate中的SQL语句

/SQLQuery sqlQuery = session.createSQLQuery(“select * from cst_customer”);
List list = sqlQuery.list();
for (Object[] objects : list) {
System.out.println(Arrays.toString(objects));
}
/

	SQLQuery sqlQuery = session.createSQLQuery("select * from cst_customer");
	sqlQuery.addEntity(Customer.class);//把查询到的数据往实体里封装
	List list = sqlQuery.list();
	for (Customer customer : list) {
		System.out.println(customer);
	}

你可能感兴趣的:(框架)