-->
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.  [ 3 posts ] 
Author Message
 Post subject: Architecture question
PostPosted: Tue Oct 21, 2003 8:19 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
It seems that most people use Hibernate within an J2EE server. In my case, I wish to use Hibernate / Sybase in a multithreaded Java server which is called by means of 1) webservices from several clients and 2) internally by the server, by several threads (i.e. when particular business events occur, etc.) Note that the WebServices server is also multithreaded.

Is Hibernate suited in this kind of setup? Is it threadsafe? What is the best way to organize Hibernate within this architecture?

Thanks for any pointers / ideas!


Top
 Profile  
 
 Post subject: threadsafe
PostPosted: Tue Oct 21, 2003 9:59 am 
Regular
Regular

Joined: Tue Sep 16, 2003 11:35 am
Posts: 93
Location: San Francisco, CA
Hibernate is definitely thread safe. Tomcat/J2EE servers use Hibernate in a threaded manner since each HTTP request is it's own thread. The usual pattern is to have one SessionFactory shared by all threads and each thread (request in Tomcat land) to have its own Session (see ThreadLocal pattern). This pattern is well tested and works well and Hibernate has been built to handle this use case. Therefore I assume the SessionFactory is thread safe while a Session is not ...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 21, 2003 12:16 pm 
Regular
Regular

Joined: Fri Sep 05, 2003 12:01 am
Posts: 80
Location: Bogot
Yes: a session factory is threadsafe!!

http://www.hibernate.org/hib_docs/reference/html/architecture.html

By the way: checkout the spring framework, it's can be used as a lightweight server to hold the hibernate session factory... It can run within a j2ee container or without

You might find it useful.

_________________
Mauricio Hern


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