Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to map returned cursor to a POJO / Bean in Hibernate?

 
hildich kilal
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have a requirement where I need to create an object based on soem big calculation. The result is from 2-3 tables and I am using an Oracle Stored procedure for the same.
The stored procedure will return a cursor.
Now how can I map the cursor directly to some Java class / POJO using EJB3 / hibernate? As I dont have any underlying table for this entity so I am getting error when i try to define NamedNativeQuery for this?

I have following definition


I have my stored procedure in place which returns a cursor with some say 5-6 columns. But as SectorDetail class can not be tied to a table (as no table exists) .
So how can I do this?

Or is the only way to do this is loop through returned cursor and get column values one by one and create a list of SectorDetail object?

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic