-->
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.  [ 1 post ] 
Author Message
 Post subject: Feature Request: The power of an N-level cache
PostPosted: Thu Feb 16, 2006 2:58 pm 
Beginner
Beginner

Joined: Wed Oct 05, 2005 2:08 pm
Posts: 23
NPersist has a feature which allows you to do this essentially:

ISession sessionWrapper = sessionFactory.OpenSession(instanceOfSessionActuallyConnectedToDatabase);

/* This statement retrieves a Customer from the DB using the instanceOfSessionActuallyConnectedToDatabase, then returns a _clone_ of the retrieved Customer business object */

Customer c = (Customer) sessionWrapper.Get(32,typeof(Customer));
c.Name ="Jim";

/* This does NOT save the changes to the database, instead it saves the changes to the instanceOfSessionActuallyConnectedToDatabase instance of the Customer */

sessionWrapper.Save();

What's the point you say?

I can make changes to a business object and catch exceptions thrown from them in the presentation layer and display the appropriate info to the user. This means I don't have to repeat my business rules in the presentation layer. When the user click's Save, my changes are written back to the NHibernate Customer proxy (but not to the database). If the user click's Cancel I just discard the wrapper session. Is there anything like this in the works for NHibernate. It seems like it would be (relatively) easy to do by just implementing the ISessionImplementor and wrapping a Session?

This is where all the NHibernate heavyweights hang out (you guys rule - I'm not worthy!) so if I can't get an answer here I'll assume that there is none.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.