JPA 去除重复列数据

   //清除重复列
        Session session = entityManager.unwrap(org.hibernate.Session.class);
        String strSql= "from AppStrategyEntity y where (y.gName,y.strategy_id)in(select x.gName,max(x.strategy_id)from AppStrategyEntity x group by x.gName)";
        //Query query = session.createQuery(strSql.toString());
        org.hibernate.Query  query = session.createQuery(strSql.toString());
        return query.list();

你可能感兴趣的:(JPA 去除重复列数据)