I can't figure out why I am getting this error. I recently changed ALL my Collections to LAZY because my application was just dragging when it had a lot of data. But this broke lots of stuff. I think I finally fixed all the stuff that broke (using Hibernate.initialize() to manually load Collections where necessary) but I have a couple pages that are still breaking.
And the error isn't your typical 'failed to lazily load a Collection' but rather 'could not initialize proxy - no Session' Now as I understand it this means you are trying to access the Hibernate session (to load something that's not loaded, for example) and it's already closed. The error occurs in my Controller. Here are my classes: class InspectionRequest { private InspectionPackage inspectionPackage; @JoinColumn(name="idInspectionPackage", insertable=false, updatable=false) public InspectionPackage getInspectionPackage() { return inspectionPackage; } } class InspectionPackage { private Set<InspectionRequests> inspectionRequests; @OneToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST }, fetch = FetchType.LAZY) @JoinColumn(name="idInspectionPackage") public Set<InspectionRequest> getInspectionRequests() { return inspectionRequests; } } Whenever I try to load a list of InspectionRequests, if ANY of those InspectionRequests has an InspectionPackage associated (idInspectionPackage != null) I get the LazyInitializationException, in the Controller, not in the page. If I debug and put a breakpoint in the Controller just before returning the List of InspectionRequests, and if I try to look at the value of the list, I get the LazyInitializationException. If, on the other hand, none of the InspectionRequests in the returned List have InspectionPackages associated it works fine. What the heck does this mean? While it's true that every InspectionRequest in the List will automagically load it's corresponding InspectionPackage (if it has one), the corresponding InspectionPackage's List of InspectionRequests will NOT be loaded, as it is LAZY. But I am not even sure that that is the problem. What am I doing wrong? Bob -- View this message in context: http://www.nabble.com/Strange-LazyInitializationException%3A-could-not-initialize-proxy---no-Session-tp17801049s2369p17801049.html Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]