• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Help me for Joinin two tables.  RSS feed

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Gokul,

Refer the below link,

Iterate the Object[]

Hope, This helps you !!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!