I am in the process of migrating from EJB 2.1 to EJB 3.0. I had a whole bunch of queries for by entity-beans which were defined in ejb-jar.xml. Once I move to EJB 3.0 I cannot seem to figure out where should those queries go - do I keep them as String in the form of NamedQueries using the @NamedQuery annotations or do I keep them in some xml. Is there any recommendation?
posted 6 years ago
there is a holywar between developers, who like xml and developers, who like annotations As for me I prefer to store queries in annotations :
Moreover, if you have query that can be dynamically changed, you can just store it like field in your entity class.