Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Where are hibernate queries generally maintained  RSS feed

 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see that queries can be defined directly in the code instead of the descriptor in case of entity beans. We had this tendency to maintain jdbc queries in a properties file and then look it up using some Factory class?
How do people normally code their queries in hibernate...?
If the hibernate query gets mixed with business logic then that w'dnt look neat either.
 
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We use 2 techniques:
- either directly HQL querying
- either named queries (defined in the mapping)
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Ali Pope:
- either named queries (defined in the mapping)





How to definded in mapping file ?
 
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read the Named query section of the tutorial
http://www.warfrog.com/hibernatetutorial/
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!