Keeping the session open and turning off lazy loading both have the same undesirable side effect of loading the entire object graph before returning a result. This can result in a very large amount of data being returned. What I was really hoping for was a way to change the way the XML was generated so that it took Hibernate Collections into mind so that I can check if it is initialized or not before descending into the collection.
I could always sever the relationships between parents and children so there would be no collections at all, but that makes my server side code a lot more messy because I'll have to keep going to the database myself to get children instead of just passing a parent object around and going to the collection of children. Isn't the ability to relate objects together one of the advantages of Hibernate? I may wind up having to do this anyway because even if I solve the hibernate issue, there is still the circular link issue - parents have children, each child points to its parent. The journey continues }:-) Steve On 8/22/07, robert lazarski <[EMAIL PROTECTED]> wrote: > > IIRC the other option is to turn lazy off so your collection aren't > proxied, which may make sense in a web service environment where > you'll probably need to gather all the objects anyways. > > Hmm, wasn't aware you could use OSIV with axis2. > > HTH, > Robert > > On 8/22/07, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: > > > > > > Hi, > > > > I'm doing just that. I've got a web application that has the axis2 > > libraries. It provides a web service as well as a web application that > > maintains a database. I use the Spring library to provide both the web > > service and the application with a DAO that interfaces with Hibernate. I > use > > Spring's OpenSessionInViewFilter to keep the session open until the > final > > result is rendered, whether it's axis or a jsp doing the rendering. > > > > If you don't want to use spring, you can write your own servlet filter > that > > opens a Hibernate session coming in and closes it going out. > > > > Michael Davis > > from sunny Ottawa > > > > > > -----Original Message----- > > From: Steve S [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, August 21, 2007 4:36 PM > > To: [email protected] > > Subject: Returning Hibernate detached objects in Axis2 > > > > > > Has anyone tried to return a Hibernate detached object in an Axis2 web > > service? I have an object with lazy-loaded collections of objects. When > I > > try to call the web service, I get a LazyInitializationException because > the > > serializer (Axiom? StAX?) is trying to iterate over the collection. What > I > > need is a way to skip the attribute if it is a PersistentSet that hasn't > > been initialized. I suspect that the actual coding is pretty simple, > the > > trick is figuring out where to put it, and how to get Axis to use it. > > > > Does anyone have any ideas? > > > > Thanks, > > > > Steve > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
