I have a fairly large (new) project in which we have annotated many domain classes with JPA mappings. Now it is time to implement many named queries -- some entities may ha
It's possible, but I don't think it's needed. I work on a lot of big projects with many named queries attached to some entities and I don't think that this clutters the source much - after all the queries are all before the class definition. The main advantage of using annotations is that you can see everything in the source. If you've extracted the queries in an xml config the presence of the named queries won't be immediately visible which I'd consider a drawback. I like to keep stuff pure - either xml only setup or only annotations setup. The only xml config I generally keep around on JPA projects in the persistence.xml.