The moose likes Object Relational Mapping and the fly likes Hibernate querying two tables using join Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate querying two tables using join" Watch "Hibernate querying two tables using join" New topic

Hibernate querying two tables using join

coder.shiv coder

Joined: Jul 26, 2013
Posts: 1
Hey guys I`m new in hibernate and in posting issues here too.

I used JDBC till now and used to code like

select * from apple as a join banana as b on b.color=a.color;


How to do this in hibernate using annotation mappings?

Please help.

vijay jacob
Ranch Hand

Joined: Jul 02, 2013
Posts: 57
Annotate the basic hibernate class. any simple hibernate example would do.

Then either you can use hql to do your sql stuff.

I believe apple and banana has no real association (mean to say one2many or many2one o)?

So i believe in that case hql is way out.

I agree. Here's the link:
subject: Hibernate querying two tables using join
It's not a secret anymore!