-->
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: Session, Web App update and Optimistic locking.
PostPosted: Tue Nov 09, 2004 4:02 pm 
Newbie

Joined: Thu Oct 07, 2004 2:10 am
Posts: 3
Hibernate version:
2.1.5

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Hello All,
Please apologize me if this question is very primitive (searched in net but cant find any related docs).
I am trying to use hibernate in one of my webapp. Its a three layered architecture with JSP and actions in web layer, Service classes through EJBs and DB layer, The web layer interacts with the service layer through model objects while the service layer interacts with DB through domain objects (hibernate objects).
In our solution,
1. webapp query the data from the service layer.
2. service layers get the data from the domain.
3. Service layer copies the required data from the domain object to model object.
4. The model data is transferred to the web app layer
5. Once the user click update/create, the webapp invokes the specific method on the service.
6. Service inturn copies the data from the model to domain.
7. Then domain object is either updated/saved.

In this type of architecture, hibernate suggests to use the following types for automatic update and through optimistic control.
Session per HTTP Session.
Hold persistent Objects and detach/attach through new sessions.

The both solns are not feasible in our case as the application session will be generally very long and also holding persistent objects across sessions is not proper as the data will be very huge.

So my questions are
1. Is it possible to set only certain set of fields in the domain object and call update and hibernate calls update with only those fields. does hibernate do any method level interception?
2. If this solution is not correct, how general 3 tiered web applications are implemented where the data cant be associated with the session due to its huge size.
3. If possible provide me some proper links.

It would be of great help, any body can provide me some help in this regard.

TIA
Karthik M


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 09, 2004 4:48 pm 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
I guess You don't want to store the data in the HttpSession because you have a cluster and want to be able to transfer HttpSession up on failover.

If yes, you could attache the data through a transient member of a class to the HttpSession to prevent serialization.

HTH
Ernst


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 10, 2004 1:42 am 
Newbie

Joined: Thu Oct 07, 2004 2:10 am
Posts: 3
ernst_pluess wrote:
I guess You don't want to store the data in the HttpSession because you have a cluster and want to be able to transfer HttpSession up on failover.

If yes, you could attache the data through a transient member of a class to the HttpSession to prevent serialization.

HTH
Ernst

Actually, I have two model object sharing the same domain model. I cant store the domain model in memory. So when i want to update, I have only a part of the domain data, so i have to query the domain again from the DB and do a update which makes two requests.
Is this the only way or can hibernate track the changes through the setter methods and provide a partial update?


Karthik


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.