| Author |
Help me for Joinin two tables.
|
Gokul Kesavalu
Greenhorn
Joined: Jan 08, 2008
Posts: 20
|
|
Hi everybody,
I am a newbie to Hibernate. I have two tables Application and ApplicationUser.
Application - fields(id(primary key),application-name,description,application_url,app_id)
ApplicationUser - fields(id(primary key),user_id,app_id,date_of_request, application_name,status)
I created a method as follows to retrieve data.
My POJO classes are as follows,
Application.java
ApplicationUser.java
But it shows me the following error.
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.action.Application
But my query works fine in query browser. please help me to fix it out..
|
 |
Vicky Vijay
Ranch Hand
Joined: Apr 23, 2008
Posts: 125
|
|
Hi Gokul,
QUERY:
select application.application_name,application.app_id,application.application_url from Application as application,ApplicationUser applicationuser
Here you are using two tables,
1.Application
2.ApplicationUser
I hope, Retrieving the data using SELECT a.field1, a.field2..........
would return as Object[]
|
 |
Gokul Kesavalu
Greenhorn
Joined: Jan 08, 2008
Posts: 20
|
|
|
Hi Guru, Thanks for the reply. Yes it return as Object. I have a pojo class for Application. How to set this in that Pojo so that i can retrieve from that. or any other modifications need to be done in query...
|
 |
Vicky Vijay
Ranch Hand
Joined: Apr 23, 2008
Posts: 125
|
|
Hello Gokul,
Refer the below link,
Iterate the Object[]
Hope, This helps you !!
|
 |
 |
|
|
subject: Help me for Joinin two tables.
|
|
|