Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can i use Hibernate for temporary tables

 
Abhi Shetty
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate version:2.0

My business rules are complex.

we are joining 2 or more tables, then putting the resultset into a temporary table. then performing some operations on the temporary table -- we are again joining the resultset from the above operations to other tables.
-- currently we are usings SPs for this purpose.

How can i acheive this in Hibernate?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

currently we are usings SPs for this purpose

Upgrade to vearion 3.0. You can map Stored Procedures as named queries in that version.

No version of Hibernate can map to temporary tables (I don't know any ORM that can), since temporary tables are not strictly part of your data model. They are transient, you may as well be trying to map to a specific piece of data.
 
Sabarish Sasidharan
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Abhi Shetty:
Hibernate version:2.0

My business rules are complex.

we are joining 2 or more tables, then putting the resultset into a temporary table. then performing some operations on the temporary table -- we are again joining the resultset from the above operations to other tables.
-- currently we are usings SPs for this purpose.

How can i acheive this in Hibernate?


Depending on the complexity, it might be possible to avoid a temporary table by using table expressions (in DB2). Though it is called something else in other RDBMS, iam sure every RDBMS supports that. So if that would work, then all can be done in one SQL. With right indexes, it will work fine as well. Then you can use Hibernate the usual way without having to worry about temporary tables.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic