On 07-10-2010 at 14:27, John Berninger wrote: > I'm getting a LazyInitializationException when I attempt to log in > to a webapp I'm writing / testing, and I'm not sure what I'm doing > wrong.
In about all cases I see this, it is caused in code that runs in a view layer. More specifically, outside the transaction for which a JPA EntityManager, Hibernate Session, JDO PersistenceManager, ... is defined. The design pattern "Open session in view" is your friend here. It ensures that even after the transaction ends, you can still query the database for the information you need on screen (read-only IIRC, but that's what you want anyway). Decisions on eagerly/lazily fetching of relationships can then be deferred to optimization time. Oscar -- ,-_ Oscar Westra van Holthe - Kind http://www.xs4all.nl/~kindop/ /() ) (__ ( Simplicity is prerequisite for reliability. =/ () -- Edsger Dijkstra, EWD498
signature.asc
Description: Digital signature
------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb
_______________________________________________ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users