These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: How operate Temporay table in Hibernate3?
PostPosted: Sun Aug 28, 2005 11:45 pm 
Beginner
Beginner

Joined: Thu Jul 07, 2005 5:17 am
Posts: 30
I need to set up a 'second search engine' in web application,so I will use Temporay table.As it is said that the new function 'dynamic class' in hibernate3 could deal with Temporay table,but I don't learn how it works concretely,sb can teach me?
It's appreciated if show me a concrete example.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2005 8:55 pm 
Beginner
Beginner

Joined: Thu Jul 07, 2005 5:17 am
Posts: 30
sb help?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 5:43 am 
Beginner
Beginner

Joined: Thu Jul 07, 2005 5:17 am
Posts: 30
sb made 'second search engine' ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 7:51 am 
Regular
Regular

Joined: Sun May 08, 2005 2:48 am
Posts: 118
Location: United Kingdom
Good question soldier.

Maybe you can dynamitcally create a map on the fly and shove it into Hibernate some how (!)

But I too can see me wanting to face this issue in the future, in my situation I can describe the object relation ahead of time with a group of dummy tables but need to just change the name of the table(s) on the fly that would map together.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 01, 2005 3:28 am 
Beginner
Beginner

Joined: Thu Jul 07, 2005 5:17 am
Posts: 30
dlmiles ,I'm not clear about what you say,can you tell me more?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 02, 2005 8:40 pm 
Regular
Regular

Joined: Sun May 08, 2005 2:48 am
Posts: 118
Location: United Kingdom
dlmiles wrote:
But I too can see me wanting to face this issue in the future, in my situation I can describe the object relation ahead of time with a group of dummy tables but need to just change the name of the table(s) on the fly that would map together.


I'm saying in a perfect world it would be nice to be able to teach Hibernate about an ABSTRACT object relationships from a generic mapping group, then on the fly turn abstract into concrete by assigning all the specific things it needs to know in order to make that transition. In this example table names would need to be assigned.

This would open the door to allow set realtionships to be created on the fly that resolve to a group of tables.


To use Hibernate at this time you describe your fixed mappings ahead of runtime use, since the creation of a SessionFactory is mandatory to use Hibernate and the processing of mappings isn't trivial. It takes an order of time to compute. This makes it somewhat difficult to realistically use dynamicmappings known only at runtime.


If the infrastructure for the above was in place then that would naturally lead a path to making dynamic temporary tables very usable feature/tool to the application programmer.


At this moment in time the best solution I can advise you is that if you can describe in mappings your temporary table(s) with fixed table names and column names/types. Then make your applications CREATE/DROP the table as necessary (maybe with JDBC) around calling hibernate functions to do work on them.

// Create SessionFactory

// Don't touch any relahionship that might make Hibernate try to access a temporary table that does not exist yet.

// JDBC CREATE TEMPORARY TABLE foobar (...);

while(hasWork == true) {
myObj = Session.get(Foobar.class, new Long(1));
// Do work
Session.saveOrUpdate(myObj);
}

Session.flush();

// JDBC DROP TEMPORARY TABLE foobar;
// or force a session reset/close of the underlying JDBC connection, so its not
// returned to the connection pool with the TEMPORARY table still in existance for
// the next user to see.


If you want fully dynamic temporary with table names known at runtime and data types / column names all dynamic, I think you are out of luck, due to SessionFactory startup overheads.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.