-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: How to get records from different tables using where conditi
PostPosted: Wed Oct 14, 2009 12:59 am 
Newbie

Joined: Wed Sep 30, 2009 8:28 am
Posts: 10
I am using mysql database

I want to display Employee Name from Employee table and Qualification from Details table.
So in my query i created objects for both the table and tried to access it.
Both table has EMPLOYEE_ID.

void showOutput()
{
String SQL_QUERY ="select emp.EMPLOYEE_NAME,det.QUALIFICATION from Employee emp,Details det where emp.EMOLYEE_ID=det.EMPLOYEE_ID";
Query query = session.createQuery(SQL_QUERY);
Iterator itr=query.iterate();
while(itr.hasNext()){
Object row[] = (Object[]) itr.next();
System.out.println("Name : " + row[0]);
System.out.println("Qualification: " + row[1]);
}
}

I am getting error while executing the query.
Please help me to overcome this situation.

Thanks in advance.


Top
 Profile  
 
 Post subject: Re: How to get records from different tables using where conditi
PostPosted: Wed Oct 14, 2009 1:35 am 
Newbie

Joined: Tue Sep 22, 2009 2:01 am
Posts: 1
Which error are you getting??
and past over entire error console


Top
 Profile  
 
 Post subject: Re: How to get records from different tables using where conditi
PostPosted: Wed Oct 21, 2009 7:23 am 
Newbie

Joined: Wed Sep 30, 2009 8:28 am
Posts: 10
I got my error rectified...
no problem in code but in mapping only..

thanks for your reply krishnau


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.