The query
Code:
select distinct s.taglia_scheda from Scheda s
only selects the taglia_scheda column, not complete Scheda objects. From the error message you get I assume that taglia_scheda is a string column. Then, your code should be like this:
Code:
Set<String> ret = new HashSet<String>();
ret.addAll(manager.createQuery("select distinct scheda.taglia_scheda from Scheda scheda").getResultList());
Another option is to use a TreeSet instead of a HashSet and then use a Comparator that works on the taglia_scheda column. Eg. something like this:
Code:
Set<Scheda> ret = new TreeSet<Scheda>(new TagliaSchedaComparator());
ret.addAll(manager.createQuery("select scheda from Scheda scheda").getResultList());