This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

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

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
author & internet detective
Posts: 39890
798
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
I didn't like the taste of tongue and it didn't like the taste of me. I will now try this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!