wood burning stoves*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply locked New topic
Author

Join using HQL

subhashchandra medhiassam
Ranch Hand

Joined: Sep 10, 2008
Posts: 72
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
 
 
subject: Join using HQL
 
Similar Threads
Could not parse mapping document from resource PojoTestTable.hbm.xml
Joining tables
Foreign Key Constraint Fails
Hibernate not inserting new record on SQL Server
Batch Delete Problem