jQuery in Action, 2nd edition*
The moose likes Object Relational Mapping and the fly likes How can i use Hibernate for temporary tables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How can i use Hibernate for temporary tables" Watch "How can i use Hibernate for temporary tables" New topic
Author

How can i use Hibernate for temporary tables

Abhi Shetty
Greenhorn

Joined: Oct 19, 2005
Posts: 1
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

Joined: Apr 14, 2004
Posts: 10336


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.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Sabarish Sasidharan
Ranch Hand

Joined: Aug 29, 2002
Posts: 73
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.


Sab<br /> <br />Perfection does not come from belief or faith. Talk does not count for anything. Parrots can do that. Perfection comes through selfless work.<br />Swami Vivekananda
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can i use Hibernate for temporary tables