• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HIbernate and virtual host

 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I have a war file that must work on 4 different domain names located on the same server.

domain1.com, domain1.se, domain2.com, domain2.se ( on the same server )

The model for these websites are exactly identical it is only lanuage and view that differs. The websites must be handled from one administration and I want to use Hibernate for ORM because they all point to the same database.

Is this possible? If I have virtual hosts in tomcat or JBoss it is 4 different instances of the war file that is loaded and what will happen with the data then? Can hibernate handle this? and how? Can this be done or do you suggest some other solution? It is vital that all stores can be administrated from one location.
 
Gaurav Bharadwaj
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have seen such a situation.
Here we created a factory pattern for getting sessionFactory objects.
At the start of application the session factories for all the different data sources are created .
This factory is then used to initialise the session factory object by looking at some criteria like users Language from the context.
Thus for English the user can use session from english session factory or
he can use session from french session factory if he has FRENCH language in his user context.

[ February 06, 2008: Message edited by: Gaurav Bharadwaj ]
[ February 06, 2008: Message edited by: Gaurav Bharadwaj ]
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic