-->
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.  [ 4 posts ] 
Author Message
 Post subject: rebuild of sessionfactory safe in multiuser environment?
PostPosted: Tue Jul 09, 2013 6:20 am 
Newbie

Joined: Tue Jul 09, 2013 5:32 am
Posts: 2
At our company we use Spring 3 / hibernate 3.6.10 to create both static and dynamic tables.
The reason for having dynamic tables is that we want a user to be able to access a dynamic table outside the application.
So a dynamic table can be access by : select column1,column2 from dynamictable1 .
This gives the user a simple way to access a dynamic table. We know hibernate provides a mapping model but this is not adequate for our purposes.

We have created two session factories:

- one for the "normal" static table structure
- one for dynamic tables.

We determine the structure of a dynamic table at runtime.
The dynamic tables are created by using javassist to create a class with proper hibernate annotations like @Entity and @OneToMany
After creation of the class we call org.hibernate.cfg.Configuration.addAnnotatedClass and do a rebuild of the sessionfactory.
The creation of new dynamic tables can happen anytime.

I've created a custom transactionmanager which administers the current open transactions and uses a stack to store rebuild sessionfactories.
When a new table is needed a sessionfactory is rebuilt put not yet made active.
When there are no transactions open, the sessionfactory is replaced.
We are concerned about the stability of the application when the replace is take place.

The question is what will happen in a multiuser environment when we replace the sessionfactory?


Last edited by mtolhuisen on Thu Sep 26, 2013 2:13 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: rebuild of sessionfactory safe in multiuser enironment?
PostPosted: Thu Jul 11, 2013 1:38 pm 
Newbie

Joined: Thu Jul 11, 2013 1:22 pm
Posts: 2
Hi mtolhuisen,
I'm just commenting to say that I'm very interested to see what the Hibernate community thinks of your topic because I am also thinking about implementing a solution similar to the one you have described. I share your concerns about the SessionFactory replacement process.


Top
 Profile  
 
 Post subject: Re: rebuild of sessionfactory safe in multiuser enironment?
PostPosted: Tue Sep 24, 2013 10:50 am 
Newbie

Joined: Thu Jul 11, 2013 1:22 pm
Posts: 2
I don't know if mtolhuisen is still checking this thread, but (as I'm having a similar problem) I'm still interested.


Top
 Profile  
 
 Post subject: Re: rebuild of sessionfactory safe in multiuser environment?
PostPosted: Thu Sep 26, 2013 2:12 am 
Newbie

Joined: Tue Jul 09, 2013 5:32 am
Posts: 2
Hi Mike,

Yes I'm checking.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.