Thread:
 Not recommended 
 damo9f   08 Mar 2005, 11:29 

Comment
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
From: damo9f (08 Mar 2005, 11:29) Replies: 0, Views: 37168
Subject: Not recommended
If I read this correctly, all code that uses persistence or calls other 
code that might use persistence has to explicitly pass around the 
session.  This leads to tight coupling:
1) moving to another persistence strategy where the dbManager/session is 
not passed around won't work with the code
2) everything needs to know if the objects it works with might use 
persistence, where that's really not the business of the caller

e.g.

void person.updateCart(cart, Session); // bad coupling

this assumes that the "cart" is persistently tracked, rather than 
cached, put into JNDI, updated via a web service, stored in a 
HTTPSession, etc.
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
© Copyright 2006, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc. [Privacy Policy]