-->
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: Dynamic mapping table to persistent class
PostPosted: Wed Oct 22, 2003 12:22 am 
Newbie

Joined: Mon Oct 20, 2003 8:18 am
Posts: 3
Hello, Hibernate team:

I am a newer to hibernate. My web project needs an O/R mapping tools. The project needs provide dynamic information to web user:

1). Web user sends its descriptions (Range from web user, may be one description or more) about their items to us.
2). So, we have to define tables for every customer to save it. We name table by customer name. All tables' main struture is same but different no. of description columns.

By searching in forum, Hibernate seems don't support dynamic mapping table and column or add/delete mapping at run time.

Do hibernate has a scuedule to support it?

Danny Chen


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 22, 2003 12:48 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
This is actually quite easy to do in Hibernate by manipulating the Configuration object.

Code:
cfg.getClassMapping(...).getTable().setName(...);
userSessionFactory = cfg.buildSessionFactory();


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 22, 2003 2:19 am 
Newbie

Joined: Mon Oct 20, 2003 8:18 am
Posts: 3
Thanks you very much.

This code is only workable that code changes mapping configuration before buildSessionFactory().

But it is impossible to build session factory every time when code changes the table name. buildSessionFactory() is slow and web page is used by many customers.

Would you please give me any idea about change mapping after buildSessionFactory()?

Danny Chen


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 22, 2003 3:39 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
That is not possible. There are very, very good reasons for this and it will never change.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 01, 2004 5:19 pm 
Beginner
Beginner

Joined: Sat Jan 31, 2004 7:19 pm
Posts: 39
Am I correct assuming that you can still build a new SessionFactory,
then replace your previous SessionFactory with it?

Or does that fail because of some internal bookkeeping in Hibernate?

(my assumptions is of course that sessions are short-lived)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 01, 2004 5:21 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
yes of course you can build SessionFactorys however you like.


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.