What JBoss version? It should not occur in 3.2.3. The first duplicate was because of ORDER BY which should be fixed. The second one, I am not sure. Do you map foreign keys to primary keys?
I doubt you will gain any significant performance improvements though just because of this.