Thursday, June 5, 2014

Examples of join and other queries for Hibernate (HQL)

Examples of usage of Hibernate query language. Could be used in repositories with @Query annotation.

1. select nid, night.night_duration, night.night_date, aid, night.area_id, from Night night, Area area where night.area_id =

2. from Bid bid left join fetch bid.item left join fetch bid.bidder where bid.amount > 100

3. from Book book inner join book.chapters chapter where chapter.title like '%hibernate%'

4. from com.package.Venue venue inner join t WHERE t.string = :name
Double join table

5. select cont from Continent cont join fetch cont.countries where = 'Europe'

1. select p from Plane p

2. select n from Night n where >= :date

Docs: Join queries in HQL

No comments:

Post a Comment