File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Join using HQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply locked New topic

Join using HQL

subhashchandra medhiassam
Ranch Hand

Joined: Sep 10, 2008
Posts: 72
I have two tables: a1 and b2 in MYSQL.

The structure for table a1 is column "identity"(int type) and column "name"(varchar type).

The structure for table b2 is column "id"(int type),column "name"(varchar type) and column "name"(varchar type).

Corresponding to these two tables i have to java classes: and b2. java.

My hibernate.cfg.xml file looks like the following:

And my mapping file, join.hbm.xml looks like the following:

I have a third class where i am trying to join tables a1 and b2. This class looks like the following:

When i execute this class, i get the following message:

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
unexpected AST node: b2 [from a1 left join b2]

Could anybody tell me where i went wrong? I guess, the HQL query is incorrect. What should be the correct query? Kindly advise.

I agree. Here's the link:
subject: Join using HQL
jQuery in Action, 3rd edition