hibernate 执行原生sql 返回实体list对象

 String sql="select gc.* from eportal_goods_category gc "+

" inner JOIN "+

" eportal_goods g on gc.id=g.goods_category_id "+

" INNER JOIN "+

" eportal_seller se on  g.supplier_id=se.id "+

" where se.id='"+id+"' GROUP BY gc.`name`";

 SQLQuery list = getSession().createSQLQuery(sql);

 List<GoodsCategory> lgs=list.addEntity(GoodsCategory.class).list();


你可能感兴趣的:(hibernate 执行原生sql 返回实体list对象)