• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting data from two tables in hibernate

 
jyoti mahajan
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator








please let me know how to implement this query in hibernate.

as i hav pojo and hbm files of these too

please let me know early
 
xsunil kumar
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jyoti, i can help you incase you are using annotations. You can use Named query to write such type of queries.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without knowing your object model we can't really tell you, though HQL is pretty much exactly the same as SQL. Also - that join looks like it is happening on a field other than the coupons* PK which is not really valid.

(* NB - data modelling tip (though this is personal preference here, so feel free to ignore) but I don't like seeing plural entity names unless these describe something that is genuinely multi-valued. Here a single row describes a single coupon)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic