-->
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: Hibernate and virtual hosts
PostPosted: Wed Feb 06, 2008 10:04 am 
Beginner
Beginner

Joined: Sun Aug 12, 2007 11:22 am
Posts: 44
Location: Sweden
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.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 06, 2008 4:43 pm 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
This is not really a Hibernate question. It is more dependent on your web host and Tomcat (or whatever container you're using). Hibernate is just a persistence layer.

_________________
Chris Bredesen
Senior Software Maintenance Engineer, JBoss


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 06, 2008 4:53 pm 
Beginner
Beginner

Joined: Mon Mar 07, 2005 6:23 pm
Posts: 21
From the hibernate side you could probably just jar up your model classes and stick in each of your war files (or in your ear if all the war files are in an ear) and it will be fine

Of course, the rest of your questions are related to your app server / httpd server


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 06, 2008 6:05 pm 
Beginner
Beginner

Joined: Sun Aug 12, 2007 11:22 am
Posts: 44
Location: Sweden
OK thanks!

What happens if the one webapp removes an articles in the database when another is iterating over it. Will it be 4 instances of hibernate? I want only one instance and 4 webapps. Can this be done?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 06, 2008 6:18 pm 
Newbie

Joined: Wed Feb 06, 2008 5:52 pm
Posts: 4
I think creating different session factory for each language is a good approch.
You can handle the issue of deleted or modified object by using optimistic or pessimestic locking provided by hibernate.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 06, 2008 6:23 pm 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
You could also easily do this with a single webapp/sessionfactory and multiple virtual hosts. A servlet filter could inspect the URL and set a session or request variable that drives the language of the content. Whether you do the virtual hosts in Tomcat or Apache is up to you. I find Apache ideal for this sort of thing, but YMMV.

_________________
Chris Bredesen
Senior Software Maintenance Engineer, JBoss


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.