This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
    Bookmark Topic Watch Topic
  • New Topic

Join using HQL

 
subhashchandra medhiassam
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,
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:
a1.java and b2. java.

a1.java:



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 Test.java 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.

Thanks,
Subhash
 
    Bookmark Topic Watch Topic
  • New Topic