• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

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 !!
 
Well don't expect me to do the dishes! This ad has been cleaned for your convenience:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic