-->
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: Hibernate in Java web - Sessions doubt
PostPosted: Thu Feb 10, 2011 3:29 pm 
Newbie

Joined: Thu Feb 10, 2011 3:20 pm
Posts: 1
Hi everyone!

I'm new in Hibernate, and I have a question about Java Web and Hibernate usage.

I'm writing a web application which will be used by more than 20 people at a time.
This means, that more than one user might be using the same feature of the application, and saving the same entity at the same time.

For example:
_ A manager can be creating several users
_ A team lead can be updating several users part of their team

So, my question is specifically about sessions. Should I use openSession() or getCurrentSession() method to handle DML operations into my MySQL database.

I'm worried about having problems with DML operations happening at the same time called by several users ( or even the same user in different AJAX calls ).

Could you please advice me on which would be the best option for me and why.

Thanks everyone in advance!

PS.: Sorry for my English, I'm a Spanish speaker :)


Top
 Profile  
 
 Post subject: Re: Hibernate in Java web - Sessions doubt
PostPosted: Thu Feb 10, 2011 4:42 pm 
Newbie

Joined: Wed Jan 26, 2011 12:32 pm
Posts: 12
Hi
you will find useful information from Hibernate reference documentation or from Hibernate in action book.
You spend time on reading chapter dedicated to Hibernate transaction management.
Let me explain what I understood from above two books
1. for simple transactions--- where unit of work is purely database operations... For example you may have
one read statement, one update statement depending upon read...
If you enclose these two between opensession and closesession..
Then Hibernate will take care of committing / roll back of this transaction in database

2. in case of web based applications.. where we find more number of concurrent users,, then transactions will be handled by container --app server, spring framework etc
In this case container will take the responsibility.
There are other concepts like
a) session per request
b) session per multiple requests
c) session per request with detached entities
sorry for providing answer in words rather than examples


Top
 Profile  
 
 Post subject: Re: Hibernate in Java web - Sessions doubt
PostPosted: Thu Mar 03, 2011 3:02 am 
Newbie

Joined: Thu Mar 03, 2011 2:45 am
Posts: 2
Have you try to check in online by using a search engine like a google. I have here some info that one of my friend tells me. Hope this little info can help in your problem here it is, xxx.netbeans.org/kb/docs/web/hibernate-jpa.html.


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.