• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB3 Entity Beans - Query Recommendation  RSS feed

 
Anurag Bhatia
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

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?

--Anurag
 
Andrey Choe
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!