File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help me for Joinin two tables.

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

Refer the below link,

Iterate the Object[]

Hope, This helps you !!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic