• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Help me for Joinin two tables.

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Gokul,

Refer the below link,

Iterate the Object[]

Hope, This helps you !!
 
Amateurs built google. Professionals built the titanic. We can't find the guy that built this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic