This week's book giveaway is in the OCAJP forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes HQL Inner Join problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "HQL Inner Join problem" Watch "HQL Inner Join problem" New topic

HQL Inner Join problem

subhashchandra medhiassam
Ranch Hand

Joined: Sep 10, 2008
Posts: 72
I have a table a1. Its columns are:
identity(int type) and name(varchar type).

I am trying to perform an inner join on this table and then print out the first column of the result obtained.

Here, is the code snippet which is supposed to do this:

When i run this program, I am getting the following error message:

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Hibernate: select a1x0_.identity as identity, as name1_ from a1 a1x0_
a1 cannot be cast to [Ljava.lang.Object;

Kindly do let me know where i went wrong.
Martijn Verburg

Joined: Jun 24, 2003
Posts: 3274

Hi there,

The log4j warnings are simply because you don't have the log4j.xml or properly configured (you need to have one in your classpath).

For the Hibernate error, are you sure that the object you are getting out of alElements is of type Object[]?

Can you also send us some more of the output? It will be interesting to see where the System.outs get to.

Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
I agree. Here's the link:
subject: HQL Inner Join problem