1.Query query = session.createSQLQuery("SQL").addEntity(Tree.class); //返回对象
List list = query.list();
2.Query query = session.createSQLQuery("SQL").setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP); //返回一个map,KEY:为DB中名称一致;
Map map = (Map)list.get[i];
map.get("id");map.get("name");
时间: 2024-11-09 18:08:27