By default Hibernate lazy loads all collection associations. The most likely problem here is that XStream is navigating the object graph, and as soon as XStream does a account.getPosts() the entire list of posts is loaded. The best approach is probably to get XStream to ignore the relevant attributes:
XStream.omitField(Account.class,"posts") Mike On 11/28/07, sarat.pediredla <[EMAIL PROTECTED]> wrote: > > > I am using Hibernate with Struts2 and XStream to dump my objects to XML. > > What is worrying is that because of the weird mapping between POJO and > Hibernate, when I have a top level object or table, ex. Account which then > has a list of Posts which in turn has a list of Comments, when I do > accountDao.getAll(), it seems to be fetching ALL the related objects which > in this case can be thousands? > > How can I work around it so that it returns ONLY the list of accounts with > Posts set to null or empty? Effectively, I do not want any joins or > associations to be loaded; just a list of Account objects. > -- > View this message in context: > http://www.nabble.com/Prevent-Hibernate-from-loading-everything%21-tf4887942s2369.html#a13990621 > Sent from the AppFuse - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >