Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

EJB3 Entity Beans - Query Recommendation

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
A teeny tiny vulgar attempt to get you to buy our stuff
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic