org.hibernate.hql.ast.QuerySyntaxException: table not mapped when table is defined as set

I think the query should be like this, otherwise it will try to find an entity named actividadGrupoBolsaTipoPieza which you don’t have:

SELECT b.nombre, COUNT(distinct b.uid), SUM(a2.numPiezas * a.cantidad * c.valor)
FROM ActividadGrupoBolsa a JOIN a.actividadGrupoBolsaTipoPieza a2, ActividadModulo b, TipoPieza c