This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes How to map returned cursor to a POJO / Bean in Hibernate? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to map returned cursor to a POJO / Bean in Hibernate?" Watch "How to map returned cursor to a POJO / Bean in Hibernate?" New topic
Author

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

hildich kilal
Ranch Hand

Joined: Aug 25, 2008
Posts: 44
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to map returned cursor to a POJO / Bean in Hibernate?
 
Similar Threads
How to call stored procedure from Entity Manager if there is out parameter in stored procedure.
Stored procedures JPA and mappings
Executing stored procedures in hibernate
Named query for stored procedure
Getting -org.hibernate.cfg.NotYetImplementedException: