File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Hibernate Mapping For Temporary Table, How to create and use a temporary table? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate Mapping For Temporary Table, How to create and use a temporary table?" Watch "Hibernate Mapping For Temporary Table, How to create and use a temporary table?" New topic
Author

Hibernate Mapping For Temporary Table, How to create and use a temporary table?

Lakshmeepathi Ghiree Anandh
Greenhorn

Joined: Sep 04, 2012
Posts: 5
Let me tell why I need a temporary table although I don't know how to create and use one in Oracle 10.

Following is the table and its values :






PARENT_ID is a foreign key to ID and both are in the same table.



Say sTree Object has the values of the row belonging to 'User Services (ID =1)'

sTree.getChildren() will return rows that has ID=2 and ID=3.

So far so good.

But based on some condition(where or join condition) I will limit the number of rows of the above table and say it looks like the following :




Now,the code


should return rows that has only ID=2.


In short,
1) I need the hibernate <one-to-many> mapping to act on the result set.
2) If not the result set should be inserted in a temporary table and the hibernate <one-to-many> mapping should act on that table.


If neither of them can be done,please suggest me another solution.

Thanks in advance.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29249
    
139

I wouldn't use a temporary table for this. It is common to want to get only some rows from a table. That's what the "where" clause is for.

You could use a separate named query that does what you want. Or you could use @Where annotation with @OneToMany. An example copied from section 2.4.6 of the documentation is:


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate Mapping For Temporary Table, How to create and use a temporary table?
 
Similar Threads
Foreign Key Must Have the Same Number Of Columns As the Referenced Primary Key
Getting "object is not an instance of declaring class" exception. Please help.
Recursive Mapping of collections
Hibernate 3.0 : Where am I going wrong?
hibernate get parent based on children