-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 posts ] 
Author Message
 Post subject: Can't get lazy loading to work
PostPosted: Tue Oct 26, 2010 7:35 pm 
Newbie

Joined: Tue Oct 26, 2010 7:03 pm
Posts: 7
I have a pattern of class use that I cannot get to lazy load. I have a class such as Document, with a list of DocumentPaths, and the DocumentPath has a reference to the Document it is for.

Code:
public class Document {
  private Date documentDate;
  private List<DocumentPath> documentPaths;
  etc...
}

public class DocumentPath {
  private Document document;
  private String path;
  etc...
}


I currently have my classes mapped like this:

Code:
<hibernate-mapping package="org.my.app">
  <class dynamic-insert="false" dynamic-update="false" mutable="true" name="org.my.app.Document" optimistic-lock="version" polymorphism="implicit" select-before-update="false" table="DOCUMENT">
    <!-- The primary key for this Document. -->
    <id column="DOCUMENTID" name="byteId" type="binary">
      <generator class="assigned"/>
    </id>

    <!-- Used for optimistic locking and to determine if an object has been saved or not. -->
    <version column="OBJECTVERSION" name="version" unsaved-value="null"/>
   
     <!-- The list of DocumentPaths for this document. -->
    <list cascade="all,delete-orphan" inverse="false" lazy="true" name="paths">
      <key column="DOCUMENTID" not-null="true"/>
      <list-index column="LISTINDEX"/>
      <one-to-many class="org.my.app.DocumentPath"/>
    </list>

    <property column="DOCUMENTDATE" name="documentDate"/>
  </class>
</hibernate-mapping>


Code:
<hibernate-mapping package="org.my.app">
  <class dynamic-insert="false" dynamic-update="false" mutable="true" name="org.my.app.DocumentPath" optimistic-lock="version" polymorphism="implicit" select-before-update="false" table="DOCUMENTPATH">
    <!-- The primary key for this DocumentPath. -->
    <id column="DOCUMENTPATHID" name="byteId" type="binary">
      <generator class="assigned"/>
    </id>
    <!-- Used for optimistic locking and to determine if an object has been saved or not. -->
    <version column="OBJECTVERSION" name="version" unsaved-value="null"/>

    <!-- The link to this DocumentPath's associated Document. -->
    <many-to-one cascade="none" class="org.my.app.Document" column="DOCUMENTID" insert="false" name="document" not-null="true" update="false"/>

    <property column="PATH" name="path"/>
  </class>
</hibernate-mapping>


anyway, I have tried changing inverse from true to false in the Document mapping, with and without the insert=false, update=false in the DocumentPath. I've tried setting not-found=exception on each of the mappings. So far I can't find anything that will lazy load the list of DocumentPaths when I load a Document.

If I do something like this:

getHibernateTemplate().loadAll(Document.class);

I get all my documents, but these are the queries that are reported:

Hibernate: /* criteria query */ select this_.DOCUMENTID as DOCUMENTID3_, ... from DOCUMENT this_
Hibernate: /* load one-to-many org.my.app.Document.paths */ select paths0_.DOCUMENTID as ... where paths0_.DOCUMENTID=?
Hibernate: /* load one-to-many org.my.app.Document.paths */ select paths0_.DOCUMENTID as ... where paths0_.DOCUMENTID=?

with one "load one-to-many" for each document to load its DocumentPath. How can I make this load lazily? Any help would be greatly appreciated as I have several sets of classes that work like this.


Top
 Profile  
 
 Post subject: Re: Can't get lazy loading to work
PostPosted: Tue Oct 26, 2010 10:15 pm 
Newbie

Joined: Tue Oct 26, 2010 7:03 pm
Posts: 7
I also cannot eagerly load the collections using anything other than multiple sub-select statements. If i set lazy=false and fetch=join or outer-join=true when I call getHibernateTemplate().loadAll(Document.class) it throws a "cannot access loading collection" exception.

So, am I stuck, do I have no choice but to have n+1 queries for my collections, since I can neither make the lazy load nor eagerly load with a join? I must say, so far, I despise hibernate! I have so far put up with it doing this for almost a year now, and have done nothing but attempt to get it to work for over 12 hours today alone. Nothing I can find works. hrm, sorry </rant>.


Top
 Profile  
 
 Post subject: Re: Can't get lazy loading to work
PostPosted: Wed Oct 27, 2010 1:50 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
In your document class, do you have equals() and/or hashCode() methods that uses the documentaPaths collection? If so, I think that is the source of your problem.


Top
 Profile  
 
 Post subject: Re: Can't get lazy loading to work
PostPosted: Wed Oct 27, 2010 12:29 pm 
Newbie

Joined: Tue Oct 26, 2010 7:03 pm
Posts: 7
hrm, equals and hashcode you say. Well, techically all of my entity objects i'm working with extend an abstract class that implements a PersistentObject interface that look like this. So I do have an overridden equals and hashcode methods but they don't use anything external to an object to determine equality.

The interface:

Code:
public interface PersistentObject<T> {

  /**
   * Gets the byte array encoded representation of the identifer for this
   * persistent object.
   *
   * @return The byte array encoded representation of the identifer.
   */
  public byte[] getByteId();

  /**
   * Sets the identifer for this persistent object to the specified byte
   * <code>array</code> encoded representation.
   *
   * @param array The byte array encoded representation of the new
   * identifer.
   */
  public void setByteId(byte[] array);

  /**
   * Gets the identifer for this persistent object.
   *
   * @return The identifer for this persistent object.
   */
  public T getId();

  /**
   * Sets the identifier of this persistent object to the specfied <code>id</code>.
   *
   * @param id The new identifier for this persistent object.
   */
  public void setId(T id);

  /**
   * Gets the string encoded representation of the identifer for this
   * persistent object.
   *
   * @return The string encoded representation of the identifer.
   */
  public String getStringId();

  /**
   * Sets the identifer for this persistent object to the specified
   * <code>string</code> encoded representation.
   *
   * @param string The string encoded representation of the new
   * identifer.
   */
  public void setStringId(String string);

  /**
   * Gets the current version of this persistent object.  Used for
   * optimistic locking.
   *
   * @return The current version.
   */
  public Integer getVersion();

  /**
   * Sets the current persistend object version to the specified
   * <code>version</code>.  Used for optimistic locking.
   *
   * @param version The new version.
   */
  public void setVersion(Integer version);

}


The abstract class all my entity objects extend:

Code:
/**
* <p>
* An <code>AbstractPersistentObject</code> is an abstract PersistentObject having id and version
* properties used during persistence to storage and that is Serializable so the id and version
* information isn't lost for concrete subclasses when they are serialized, as in RMI calls etc.  The
* #equals() and #hashCode() methods have been overridden to enforce object identity to be
* defined as the object id and nothing else.  Object ids are set during object creation to avoid
* objects with null ids which would evaluate to be the same object.  This results in ids always being
* available and having the same meaning in java, in hibernate, and in the database.  Determining
* whether or not an object has been persisted should be done with the version property which is
* also used for optimistic locking.  Property change support is provided to allow easy firing of
* events on property changes.  PropertyChangeEvents will be fired on changes to id and version.
* </p>
* <p>
* WARNING: Generally the id of a persistent object should NOT be changed at any time during its
* lifecycle.  As #equals()  and #hashCode() are now dependent on id, if the id is changed while an
* AbstractPersistentObject is in a java collection it WILL BE LOST as collections depend on these
* methods to return invariant results.  Also note that AbstractPersistentObjects with null ids will be
* identified as the equal and as the same object via the #hashCode(), which may also have
* impacts when working with collections.  Unless you REALLY know what you are doing, it is
* recommended that id values remain invariant.  Accessor methods are provided to allow the
* Hibernate framework to set proper ids when marshalling objects from persistent storage.
* </p>
*
* @author aarmistead
*/
public abstract class AbstractPersistentObject implements PersistentObject<UUID>, Serializable {

  /**
   * The id for this persistent object.  This is set as soon as possible to avoid null ids
   * which evaluate as equal.
   */
  private UUID id = UUIDFactory.getInstance().createId();

  /**
   * The version of this object.  Used to during optimistic locking and to determine
   * if the object has been persisted or not.  This value will be null if the object has
   * never been persisted.
   */
  private Integer version;

  /**
   * The property change support for this persistent object.  This is set in place to avoid
   * having to call a superclass constructor and is protected to allow access from
   * concrete implementation classes.
   */
  private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);

  /**
   * @inheritDoc
   */
  @Override
  public byte[] getByteId() {
    return UUIDFactory.getInstance().toByteArray(id);
  }

  /**
   * @inheritDoc
   */
  @Override
  public void setByteId(byte[] array) {
    UUID oldId = this.id;
    id = UUIDFactory.getInstance().fromByteArray(array);
    changeSupport.firePropertyChange("id", oldId, id);
  }

  /**
   * @inheritDoc
   */
  @Override
  public UUID getId() {
    return id;
  }

  /**
   * @inheritDoc
   */
  @Override
  public void setId(UUID id) {
    UUID oldID = this.id;
    this.id = id;
    changeSupport.firePropertyChange("id", oldID, id);
  }

  /**
   * @inheritDoc
   */
  @Override
  public String getStringId() {
    return UUIDFactory.getInstance().toString(id);
  }

  /**
   * @inheritDoc
   */
  @Override
  public void setStringId(String string) {
    UUID oldId = this.id;
    id = UUIDFactory.getInstance().fromString(string);
    changeSupport.firePropertyChange("id", oldId, id);
  }

  /**
   * @inheritDoc
   */
  @Override
  public Integer getVersion() {
    return version;
  }

  /**
   * @inheritDoc
   */
  @Override
  public void setVersion(Integer version) {
    Integer oldVersion = this.version;
    this.version = version;
    changeSupport.firePropertyChange("version", oldVersion, version);
  }

  /**
   * Adds the specified property change <code>listener</code> to the listener
   * list. The listener is registered for all properties.  The same listener object
   * may be added more than once, and will be called as many times as it is
   * added.  If the listener is null, no exception is thrown and no action is taken.
   *
   * @param listener The PropertyChangeListener to be added.
   */
  public void addPropertyChangeListener(PropertyChangeListener listener) {
    changeSupport.addPropertyChangeListener(listener);
  }

  /**
   * Adds the specified property change <code>listener</code> for the
   * specified <code>propertyName</code>.  The listener will be invoked
   * only when a call on firePropertyChange names that specific property.
   * The same listener object may be added more than once.  For each
   * property, the listener will be invoked the number of times it was added
   * for that property.  If propertyName or listener is null, no exception is
   * thrown and no action is taken.
   *
   * @param propertyName The name of the property to listen to.
   * @param listener The PropertyChangeListener to be added.
   */
  public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
    changeSupport.addPropertyChangeListener(propertyName, listener);
  }

  /**
   * Remove the specified property change <code>listener</code> from the
   * listener list.  This removes a PropertyChangeListener that was registered
   * for all properties.  If listener was added more than once to the same event
   * source, it will be notified one less time after being removed.  If listener is
   * null, or was never added, no exception is thrown and no action is taken.
   *
   * @param listener The PropertyChangeListener to be removed.
   */
  public void removePropertyChangeListener(PropertyChangeListener listener) {
    changeSupport.removePropertyChangeListener(listener);
  }

  /**
   * Remove the specified property change <code>listener</code> for the specified
   * <code>propertyName</code>.  If listener was added more than once to the
   * same event source for the specified property, it will be notified one less time
   * after being removed.  If propertyName is null, no exception is thrown and no
   * action is taken.  If listener is null, or was never added for the specified property,
   * no exception is thrown and no action is taken.
   *
   * @param propertyName The name of the property that was listened to.
   * @param listener The PropertyChangeListener to be removed.
   */
  public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
    changeSupport.removePropertyChangeListener(propertyName, listener);
  }

  /**
   * Indicates whether the specified <code>object</code> is "equal to" this one.
   * If both objects are non-null PersistentObjects their id's are compared for equality,
   * otherwise they are not equal.  If this object is compared to itself this returns true.
   * If this objects id is null this returns false.  This is intended to enforce object equality
   * to be defined as the object id only, and as such this method is final.
   *
   * @param object The object with which to compare.
   * @return  True if this object is the same as the specified object; false otherwise.
   */
  @Override
  final public boolean equals(Object object) {
    if(this == object) {
      return true;
    }

    // If the object is null or not a PersistentObject return false.
    // instanceof will return false if object is null.
    if(!(object instanceof PersistentObject)) {
      return false;
    }

    // If the id is missing, return false.
    if(id == null) {
      return false;
    }

    // Compare ids
    return id.equals(((PersistentObject)object).getId());
  }

  /**
   * Fire an existing PropertyChangeEvent to any registered listeners. No event is fired if the
   * given event's old and new values are equal and non-null.
   *
   * @param e The property change event.
   */
  public void firePropertyChange(PropertyChangeEvent e) {
    changeSupport.firePropertyChange(e);
  }

  /**
   * Report a boolean bound property update to any registered listeners. No event is fired if
   * old and new are equal.  This is merely a convenience wrapper around the more general
   * firePropertyChange method that takes Object values.
   *
   * @param propertyName The name of the property that was changed.
   * @param oldValue The old value of the property.
   * @param newValue The new value of the property.
   */
  public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {
    changeSupport.firePropertyChange(propertyName, oldValue, newValue);
  }

  /**
   * Report an int bound property update to any registered listeners. No event is fired if old
   * and new are equal.  This is merely a convenience wrapper around the more general
   * firePropertyChange method that takes Object values.
   *
   * @param propertyName The name of the property that was changed.
   * @param oldValue The old value of the property.
   * @param newValue The new value of the property.
   */
  public void firePropertyChange(String propertyName, int oldValue, int newValue) {
    changeSupport.firePropertyChange(propertyName, oldValue, newValue);
  }

  /**
   * Report a bound property update to any registered listeners. No event is fired if old and
   * new are equal and non-null.  This is merely a convenience wrapper around the more
   * general firePropertyChange method that takes PropertyChangeEvent value.
   *
   * @param propertyName The name of the property that was changed.
   * @param oldValue The old value of the property.
   * @param newValue The new value of the property.
   */
  public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
    changeSupport.firePropertyChange(propertyName, oldValue, newValue);
  }


  /**
   * Gets the hash code of the id for this persistent object, unless its id is null, then get the
   * original hash code.  This is intended to enforce object identity to be defined as the
   * object id only, and as such this method is final.
   *
   * @return The hash code of the id if it is not null, otherwise the original hash code.
   */
  @Override
  final public int hashCode() {
    return id == null ? super.hashCode() : id.hashCode();
  }

  /**
   * @inheritDoc
   */
  @Override
  public String toString() {
    return this.getClass().getName() + "[id=" + id + "]";
  }

}


The comment in the AbstractPersistentObject class describes why I have set up the equals and hashcode methods the way they are. If you want more about why/how that works, I got the idea from here: http://onjava.com/pub/a/onjava/2006/09/ ... tml?page=3 I don't see how this would be causing my problem, but I certainly won't deny that it could be. Do you still think this is related?


Top
 Profile  
 
 Post subject: Re: Can't get lazy loading to work
PostPosted: Wed Oct 27, 2010 2:14 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
It's a lot more complex setup than what the initial post indicates. I can assure you that Hibernate usually has no problem with lazy collections. The reason that I asked about equals()/hashCode() is that I have seen several examples were the contents of collections were used and thus triggered the lazy initialization. It doesn't seem like this is happening in your case. Using the id should be safe. Have tried to enable Hibernate logging? You will get a huge log file but it is possible you can find what is triggering the lazy initialization. Another option would be to add some debug output to the DocumentPath constructor.

Something like this can be really useful:

Code:
public DocumentPath ()
{
   new Throwable().printStackTrace();
}


Top
 Profile  
 
 Post subject: Re: Can't get lazy loading to work
PostPosted: Wed Oct 27, 2010 3:08 pm 
Newbie

Joined: Tue Oct 26, 2010 7:03 pm
Posts: 7
To test this, I commented out the overridden hashCode and equals method in my AbstractPersistentObject class my persistent objects are derived from, now they have default implementations of them. I get the same behavior and here is a chunk of the debug messages I'm getting. In this instance I'm trying to load a list of Folders that each can have a list of ChartFolders attached. Same setup as Document/DocumentPath. I have removed the one-to-many link in ChartFolder -> Folder to attempt to minimize the complexity, and it still works the same. My collection is defined like this:

Code:
<list name="charts">
  <key column="FOLDERID" not-null="true"/>
  <list-index column="LISTINDEX"/>
  <one-to-many class="org.chd.hydra.entity.ChartFolder"/>
</list>


So it doesn't look like equals and hashcode are causing it.
Here is a chunk of debug messages:

Code:
11:53:35,338 DEBUG SessionImpl:220 - opened session at timestamp: 12882056153
11:53:35,369 DEBUG ConnectionManager:421 - opening JDBC connection
11:53:35,384 DEBUG JDBCTransaction:54 - begin
11:53:35,384 DEBUG JDBCTransaction:59 - current autocommit status: true
11:53:35,384 DEBUG JDBCTransaction:62 - disabling autocommit
11:53:35,384 DEBUG HibernateDao:318 - Finding all entities of type org.chd.hydra.entity.Folder and inflating the following properties: [charts, parent]
11:53:35,416 DEBUG AbstractBatcher:366 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
11:53:35,478 DEBUG SQL:401 -
    /* criteria query */ select
        this_.FOLDERID as FOLDERID5_0_,
        this_.OBJECTVERSION as OBJECTVE2_5_0_,
        this_.PARENTID as PARENTID5_0_,
        this_.DESCRIPTION as DESCRIPT4_5_0_,
        this_.NAME as NAME5_0_,
        this_.SORTORDER as SORTORDER5_0_
    from
        FOLDER this_
11:53:35,509 DEBUG AbstractBatcher:382 - about to open ResultSet (open ResultSets: 0, globally: 0)
11:53:35,509 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#8ac471e18966c2f33f45cf2c5c293b1b]
11:53:35,525 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#922bddabd226cf2e0099db5a5263de4b]
11:53:35,525 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#93ca0d817d7bc7a438d6b0194acbcd7a]
11:53:35,525 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#9dca0ddfcdf4cc7f16c94d00fc29a211]
11:53:35,603 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#a7c27f667b5dcc8a302b5121a2368aa0]
11:53:35,603 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#b1b60d415e7dc8c004d7dc6224d7adc8]
11:53:35,603 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#bfefe47e3022c61f00b33c9732fbf439]
11:53:35,603 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#cf12bffdd3a4cba9027fdfc5895e8abc]
11:53:35,603 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#dabe75c2f5e7c53d2dc6e01fbb78cc3f]
11:53:35,697 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#dd0a97c0564bc979120441b43fd26dea]
11:53:35,697 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#e10b8e8563b1c0ca3ecf874b1ca44b61]
11:53:35,697 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#ef5d8713c55dc3c40d533737a84b5700]
11:53:35,713 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#f5a65d7c3fafcb610082912316b92275]
11:53:35,713 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#fbd76cf6a69fc4851910f454b3ab1a88]
11:53:35,822 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#fecef92b5a66c17d3fc1089fc709c619]
11:53:35,822 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#2eb19d9db65ac3892d9bb27286040ff8]
11:53:35,822 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#3ad65661dfa0c5f926c902ac1f5bb5be]
11:53:35,822 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#566228d60723cf100cadead99cc9e39c]
11:53:35,822 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#5dbd6643ddb7ca7917d6241974f706c2]
11:53:35,916 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#60d64943e522c98814725098fb551780]
11:53:35,916 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#6e1bc19ca7c1cad321826d1b37a6e0c2]
11:53:35,916 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#7a050a803d54c3dc03d3dd517eb62a47]
11:53:35,916 DEBUG Loader:1173 - result row: EntityKey[org.chd.hydra.entity.Folder#7c5e4721d3d4ce16058e53dd059325b1]
11:53:35,916 DEBUG AbstractBatcher:389 - about to close ResultSet (open ResultSets: 1, globally: 1)
11:53:36,009 DEBUG AbstractBatcher:374 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
11:53:36,025 DEBUG TwoPhaseLoad:107 - resolving associations for [org.chd.hydra.entity.Folder#8ac471e18966c2f33f45cf2c5c293b1b]
11:53:36,056 DEBUG Loader:1986 - loading collection: [org.chd.hydra.entity.Folder.charts#8ac471e18966c2f33f45cf2c5c293b1b]
11:53:36,056 DEBUG AbstractBatcher:366 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
11:53:36,056 DEBUG SQL:401 -
    /* load one-to-many org.chd.hydra.entity.Folder.charts */ select
        charts0_.FOLDERID as FOLDERID1_,
        charts0_.CHARTFOLDERID as CHARTFOL1_1_,
        charts0_.LISTINDEX as LISTINDEX1_,
        charts0_.CHARTFOLDERID as CHARTFOL1_1_0_,
        charts0_.OBJECTVERSION as OBJECTVE2_1_0_,
        charts0_.SORTORDER as SORTORDER1_0_
    from
        CHARTFOLDERS charts0_
    where
        charts0_.FOLDERID=?
11:53:36,119 DEBUG AbstractBatcher:382 - about to open ResultSet (open ResultSets: 0, globally: 0)
11:53:36,119 DEBUG Loader:1054 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#8ac471e18966c2f33f45cf2c5c293b1b]
11:53:36,134 DEBUG AbstractBatcher:389 - about to close ResultSet (open ResultSets: 1, globally: 1)
11:53:36,134 DEBUG AbstractBatcher:374 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
11:53:36,134 DEBUG CollectionLoadContext:217 - 1 collections were found in result set for role: org.chd.hydra.entity.Folder.charts
11:53:36,213 DEBUG CollectionLoadContext:260 - collection fully initialized: [org.chd.hydra.entity.Folder.charts#8ac471e18966c2f33f45cf2c5c293b1b]
11:53:36,213 DEBUG CollectionLoadContext:226 - 1 collections initialized for role: org.chd.hydra.entity.Folder.charts
11:53:36,228 DEBUG Loader:2010 - done loading collection
11:53:36,228 DEBUG TwoPhaseLoad:206 - done materializing entity [org.chd.hydra.entity.Folder#8ac471e18966c2f33f45cf2c5c293b1b]
11:53:36,228 DEBUG TwoPhaseLoad:107 - resolving associations for [org.chd.hydra.entity.Folder#922bddabd226cf2e0099db5a5263de4b]
11:53:36,322 DEBUG Loader:1986 - loading collection: [org.chd.hydra.entity.Folder.charts#922bddabd226cf2e0099db5a5263de4b]
11:53:36,322 DEBUG AbstractBatcher:366 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
11:53:36,322 DEBUG SQL:401 -
    /* load one-to-many org.chd.hydra.entity.Folder.charts */ select
        charts0_.FOLDERID as FOLDERID1_,
        charts0_.CHARTFOLDERID as CHARTFOL1_1_,
        charts0_.LISTINDEX as LISTINDEX1_,
        charts0_.CHARTFOLDERID as CHARTFOL1_1_0_,
        charts0_.OBJECTVERSION as OBJECTVE2_1_0_,
        charts0_.SORTORDER as SORTORDER1_0_
    from
        CHARTFOLDERS charts0_
    where
        charts0_.FOLDERID=?


.
.
.
26 more like this...
.
.
.
11:53:42,462 DEBUG SQL:401 -
    /* load one-to-many org.chd.hydra.entity.Folder.charts */ select
        charts0_.FOLDERID as FOLDERID1_,
        charts0_.CHARTFOLDERID as CHARTFOL1_1_,
        charts0_.LISTINDEX as LISTINDEX1_,
        charts0_.CHARTFOLDERID as CHARTFOL1_1_0_,
        charts0_.OBJECTVERSION as OBJECTVE2_1_0_,
        charts0_.SORTORDER as SORTORDER1_0_
    from
        CHARTFOLDERS charts0_
    where
        charts0_.FOLDERID=?
11:53:42,556 DEBUG AbstractBatcher:382 - about to open ResultSet (open ResultSets: 0, globally: 0)
11:53:42,572 DEBUG Loader:1054 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#7c5e4721d3d4ce16058e53dd059325b1]
11:53:42,572 DEBUG AbstractBatcher:389 - about to close ResultSet (open ResultSets: 1, globally: 1)
11:53:42,572 DEBUG AbstractBatcher:374 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
11:53:42,572 DEBUG CollectionLoadContext:217 - 1 collections were found in result set for role: org.chd.hydra.entity.Folder.charts
11:53:42,666 DEBUG CollectionLoadContext:260 - collection fully initialized: [org.chd.hydra.entity.Folder.charts#7c5e4721d3d4ce16058e53dd059325b1]
11:53:42,666 DEBUG CollectionLoadContext:226 - 1 collections initialized for role: org.chd.hydra.entity.Folder.charts
11:53:42,666 DEBUG Loader:2010 - done loading collection
11:53:42,666 DEBUG TwoPhaseLoad:206 - done materializing entity [org.chd.hydra.entity.Folder#7c5e4721d3d4ce16058e53dd059325b1]
11:53:42,666 DEBUG StatefulPersistenceContext:790 - initializing non-lazy collections
11:53:42,759 DEBUG DistinctRootEntityResultTransformer:46 - transformed: 23 rows to: 23 distinct results
11:53:44,587 DEBUG JDBCTransaction:103 - commit
11:53:44,587 DEBUG JDBCTransaction:193 - re-enabling autocommit
11:53:44,587 DEBUG JDBCTransaction:116 - committed JDBC Connection
11:53:44,681 DEBUG ConnectionManager:302 - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
11:53:44,681 DEBUG ConnectionManager:441 - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
11:53:44,697 DEBUG ConnectionManager:302 - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!


If I add fetch=join to the list tag I get exceptions like this:

Code:
12:08:01,004 DEBUG SessionImpl:220 - opened session at timestamp: 12882064810
12:08:01,004 DEBUG ConnectionManager:421 - opening JDBC connection
12:08:01,004 DEBUG JDBCTransaction:54 - begin
12:08:01,004 DEBUG JDBCTransaction:59 - current autocommit status: true
12:08:01,004 DEBUG JDBCTransaction:62 - disabling autocommit
12:08:01,004 DEBUG HibernateDao:318 - Finding all entities of type org.chd.hydra.entity.Folder and inflating the following properties: [charts, parent]
12:08:01,019 DEBUG AbstractBatcher:366 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
12:08:01,098 DEBUG SQL:401 -
    /* criteria query */ select
        this_.FOLDERID as FOLDERID5_1_,
        this_.OBJECTVERSION as OBJECTVE2_5_1_,
        this_.PARENTID as PARENTID5_1_,
        this_.DESCRIPTION as DESCRIPT4_5_1_,
        this_.NAME as NAME5_1_,
        this_.SORTORDER as SORTORDER5_1_,
        charts2_.FOLDERID as FOLDERID3_,
        charts2_.CHARTFOLDERID as CHARTFOL1_3_,
        charts2_.LISTINDEX as LISTINDEX3_,
        charts2_.CHARTFOLDERID as CHARTFOL1_1_0_,
        charts2_.OBJECTVERSION as OBJECTVE2_1_0_,
        charts2_.SORTORDER as SORTORDER1_0_
    from
        FOLDER this_
    left outer join
        CHARTFOLDERS charts2_
            on this_.FOLDERID=charts2_.FOLDERID
Hibernate:
    /* criteria query */ select
        this_.FOLDERID as FOLDERID5_1_,
        this_.OBJECTVERSION as OBJECTVE2_5_1_,
        this_.PARENTID as PARENTID5_1_,
        this_.DESCRIPTION as DESCRIPT4_5_1_,
        this_.NAME as NAME5_1_,
        this_.SORTORDER as SORTORDER5_1_,
        charts2_.FOLDERID as FOLDERID3_,
        charts2_.CHARTFOLDERID as CHARTFOL1_3_,
        charts2_.LISTINDEX as LISTINDEX3_,
        charts2_.CHARTFOLDERID as CHARTFOL1_1_0_,
        charts2_.OBJECTVERSION as OBJECTVE2_1_0_,
        charts2_.SORTORDER as SORTORDER1_0_
    from
        FOLDER this_
    left outer join
        CHARTFOLDERS charts2_
            on this_.FOLDERID=charts2_.FOLDERID
12:08:01,098 DEBUG AbstractBatcher:382 - about to open ResultSet (open ResultSets: 0, globally: 0)
12:08:01,113 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#8ac471e18966c2f33f45cf2c5c293b1b]
12:08:01,113 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#8ac471e18966c2f33f45cf2c5c293b1b]
12:08:01,113 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#922bddabd226cf2e0099db5a5263de4b]
12:08:01,113 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#922bddabd226cf2e0099db5a5263de4b]
12:08:01,207 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#93ca0d817d7bc7a438d6b0194acbcd7a]
12:08:01,207 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#93ca0d817d7bc7a438d6b0194acbcd7a]
12:08:01,207 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#9dca0ddfcdf4cc7f16c94d00fc29a211]
12:08:01,207 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#9dca0ddfcdf4cc7f16c94d00fc29a211]
12:08:01,316 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#a7c27f667b5dcc8a302b5121a2368aa0]
12:08:01,316 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#a7c27f667b5dcc8a302b5121a2368aa0]
12:08:01,316 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#b1b60d415e7dc8c004d7dc6224d7adc8]
12:08:01,332 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#b1b60d415e7dc8c004d7dc6224d7adc8]
12:08:01,410 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#bfefe47e3022c61f00b33c9732fbf439]
12:08:01,410 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#bfefe47e3022c61f00b33c9732fbf439]
12:08:01,410 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#cf12bffdd3a4cba9027fdfc5895e8abc]
12:08:01,410 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#cf12bffdd3a4cba9027fdfc5895e8abc]
12:08:01,519 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#dabe75c2f5e7c53d2dc6e01fbb78cc3f]
12:08:01,535 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#dabe75c2f5e7c53d2dc6e01fbb78cc3f]
12:08:01,535 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#dd0a97c0564bc979120441b43fd26dea]
12:08:01,535 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#dd0a97c0564bc979120441b43fd26dea]
12:08:01,629 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#e10b8e8563b1c0ca3ecf874b1ca44b61]
12:08:01,629 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#e10b8e8563b1c0ca3ecf874b1ca44b61]
12:08:01,629 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#ef5d8713c55dc3c40d533737a84b5700]
12:08:01,629 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#ef5d8713c55dc3c40d533737a84b5700]
12:08:01,723 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#f5a65d7c3fafcb610082912316b92275]
12:08:01,723 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#f5a65d7c3fafcb610082912316b92275]
12:08:01,738 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#fbd76cf6a69fc4851910f454b3ab1a88]
12:08:01,738 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#fbd76cf6a69fc4851910f454b3ab1a88]
12:08:01,832 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#fecef92b5a66c17d3fc1089fc709c619]
12:08:01,832 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#fecef92b5a66c17d3fc1089fc709c619]
12:08:01,832 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#2eb19d9db65ac3892d9bb27286040ff8]
12:08:01,832 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#2eb19d9db65ac3892d9bb27286040ff8]
12:08:01,926 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#3ad65661dfa0c5f926c902ac1f5bb5be]
12:08:01,926 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#3ad65661dfa0c5f926c902ac1f5bb5be]
12:08:01,926 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#566228d60723cf100cadead99cc9e39c]
12:08:01,941 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#566228d60723cf100cadead99cc9e39c]
12:08:02,035 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#5dbd6643ddb7ca7917d6241974f706c2]
12:08:02,035 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#5dbd6643ddb7ca7917d6241974f706c2]
12:08:02,035 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#60d64943e522c98814725098fb551780]
12:08:02,035 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#60d64943e522c98814725098fb551780]
12:08:02,129 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#6e1bc19ca7c1cad321826d1b37a6e0c2]
12:08:02,144 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#6e1bc19ca7c1cad321826d1b37a6e0c2]
12:08:02,144 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#7a050a803d54c3dc03d3dd517eb62a47]
12:08:02,144 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#7a050a803d54c3dc03d3dd517eb62a47]
12:08:02,238 DEBUG Loader:1173 - result row: null, EntityKey[org.chd.hydra.entity.Folder#7c5e4721d3d4ce16058e53dd059325b1]
12:08:02,238 DEBUG Loader:1018 - result set contains (possibly empty) collection: [org.chd.hydra.entity.Folder.charts#7c5e4721d3d4ce16058e53dd059325b1]
12:08:02,238 DEBUG AbstractBatcher:389 - about to close ResultSet (open ResultSets: 1, globally: 1)
12:08:02,238 DEBUG AbstractBatcher:374 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
12:08:02,238 DEBUG TwoPhaseLoad:107 - resolving associations for [org.chd.hydra.entity.Folder#8ac471e18966c2f33f45cf2c5c293b1b]
12:08:02,332 ERROR LazyInitializationException:19 - illegal access to loading collection
org.hibernate.LazyInitializationException: illegal access to loading collection
        at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:341)
        at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
        at org.hibernate.collection.PersistentList.listIterator(PersistentList.java:347)
        at java.util.AbstractList.equals(AbstractList.java:503)
        at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:273)
        at org.chd.hydra.entity.AbstractPersistentObject.firePropertyChange(AbstractPersistentObject.java:270)
        at org.chd.hydra.entity.Folder.setCharts(Folder.java:92)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:42)
        at org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:337)
        at org.hibernate.tuple.entity.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:200)
        at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3566)
        at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:129)
        at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:854)
        at org.hibernate.loader.Loader.doQuery(Loader.java:729)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
        at org.hibernate.loader.Loader.doList(Loader.java:2220)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
        at org.hibernate.loader.Loader.list(Loader.java:2099)
        at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
        at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
        at org.springframework.orm.hibernate3.HibernateTemplate$5.doInHibernate(HibernateTemplate.java:590)
        at org.springframework.orm.hibernate3.HibernateTemplate$5.doInHibernate(HibernateTemplate.java:1)
        at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
        at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
        at org.springframework.orm.hibernate3.HibernateTemplate.loadAll(HibernateTemplate.java:584)
        at org.chd.hydra.dao.HibernateDao.findAll(HibernateDao.java:325)
        at org.chd.hydra.service.DataServiceImpl.getAll(DataServiceImpl.java:85)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy71.getAll(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.remoting.support.RemoteInvocationTraceInterceptor.invoke(RemoteInvocationTraceInterceptor.java:77)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy78.getAll(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.remoting.support.RemoteInvocation.invoke(RemoteInvocation.java:205)
        at org.springframework.remoting.support.DefaultRemoteInvocationExecutor.invoke(DefaultRemoteInvocationExecutor.java:38)
        at org.springframework.remoting.support.RemoteInvocationBasedExporter.invoke(RemoteInvocationBasedExporter.java:78)
        at org.springframework.remoting.support.RemoteInvocationBasedExporter.invokeAndCreateResult(RemoteInvocationBasedExporter.java:114)
        at org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter.handleRequest(HttpInvokerServiceExporter.java:74)
        at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:49)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:774)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
        at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
        at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:174)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.securechannel.ChannelProcessingFilter.doFilterHttp(ChannelProcessingFilter.java:116)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
        at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
        at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
        at java.lang.Thread.run(Thread.java:619)
12:08:02,582 DEBUG JDBCTransaction:152 - rollback
12:08:02,582 DEBUG JDBCTransaction:193 - re-enabling autocommit
12:08:02,582 DEBUG JDBCTransaction:163 - rolled back JDBC Connection
12:08:02,582 DEBUG ConnectionManager:302 - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
12:08:02,582 DEBUG ConnectionManager:441 - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
12:08:02,582 DEBUG ConnectionManager:302 - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
12:08:02,629  WARN LoadContexts:108 - fail-safe cleanup (collections) : org.hibernate.engine.loading.CollectionLoadContext@f2bc85<rs=org.apache.commons.dbcp.DelegatingResultSet@966db5>
12:08:02,644  WARN CollectionLoadContext:329 - On CollectionLoadContext#cleanup, localLoadingCollectionKeys contained [23] entries
12:08:02,644  WARN RemoteInvocationTraceInterceptor:87 - Processing of HttpInvokerServiceExporter remote call resulted in fatal exception: org.chd.hydra.service.DataService.getAll
java.lang.RuntimeException: java.lang.RuntimeException: illegal access to loading collection
        at org.chd.hydra.dao.HibernateDao.purgeException(HibernateDao.java:199)
        at org.chd.hydra.dao.HibernateDao.findAll(HibernateDao.java:327)
        at org.chd.hydra.service.DataServiceImpl.getAll(DataServiceImpl.java:85)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy71.getAll(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.remoting.support.RemoteInvocationTraceInterceptor.invoke(RemoteInvocationTraceInterceptor.java:77)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy78.getAll(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.remoting.support.RemoteInvocation.invoke(RemoteInvocation.java:205)
        at org.springframework.remoting.support.DefaultRemoteInvocationExecutor.invoke(DefaultRemoteInvocationExecutor.java:38)
        at org.springframework.remoting.support.RemoteInvocationBasedExporter.invoke(RemoteInvocationBasedExporter.java:78)
        at org.springframework.remoting.support.RemoteInvocationBasedExporter.invokeAndCreateResult(RemoteInvocationBasedExporter.java:114)
        at org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter.handleRequest(HttpInvokerServiceExporter.java:74)
        at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:49)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:774)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
        at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
        at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:174)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.securechannel.ChannelProcessingFilter.doFilterHttp(ChannelProcessingFilter.java:116)
        at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
        at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
        at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
        at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
        at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.RuntimeException: illegal access to loading collection
        at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:679)
        at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
        at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
        at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
        at org.springframework.orm.hibernate3.HibernateTemplate.loadAll(HibernateTemplate.java:584)
        at org.chd.hydra.dao.HibernateDao.findAll(HibernateDao.java:325)
        ... 89 more



Top
 Profile  
 
 Post subject: Re: Can't get lazy loading to work
PostPosted: Wed Oct 27, 2010 4:41 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Code:
at java.util.AbstractList.equals(AbstractList.java:503)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:273)
at org.chd.hydra.entity.AbstractPersistentObject.firePropertyChange(AbstractPersistentObject.java:270)
at org.chd.hydra.entity.Folder.setCharts(Folder.java:92)


This is in the last stacktrace and the it seems like there is code in the firePropertyChange() method that causes the collection to be initialized.


Top
 Profile  
 
 Post subject: Re: Can't get lazy loading to work
PostPosted: Wed Oct 27, 2010 5:02 pm 
Newbie

Joined: Tue Oct 26, 2010 7:03 pm
Posts: 7
Ok, that was what was stopping me from being able to load everything eagerly with a fetch=join or outer-join= true, so I can now eagerly load the collections with 1 query and only lose my ability to fire property changes when the collection is changed out, which isn't a big deal. Just tried everything I know of after this fix to lazy load, but it hasn't changed anything about that not working. Now I can load everything in 1 query, or load everything in n+1 queries, but still no lazy anything.


Top
 Profile  
 
 Post subject: Re: Can't get lazy loading to work
PostPosted: Wed Oct 27, 2010 5:22 pm 
Newbie

Joined: Tue Oct 26, 2010 7:03 pm
Posts: 7
My bad, I had some other property event firing going on. When i stripped all property events it fixed it. Thanks for helping me figure this out! You, are awesome and I shall worship you today as a king among men!

Edit: hrmph, any idea how to handle property changes then? Maybe a way to not fire them if hibernate is the one changing properties or something?


Top
 Profile  
 
 Post subject: Re: Can't get lazy loading to work
PostPosted: Thu Oct 28, 2010 2:06 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
I have not worked with the PropertyChangeSupport myself, but it seems a bit odd that it should have to test for changes when there is no registered listeners. I assume that you'll add listeners by calling AbstractPersistentObject.addPropertyChangeListener() and that you can't do this until Hibernate has returned the object to you. So, maybe you can add some code that keep track of how many listeners that has been added and only call firePropertyChange() if there is at least one. Seems like this could be done in he AbstractPersistentObject.firePropertyChange() method.


Top
 Profile  
 
 Post subject: Re: Can't get lazy loading to work
PostPosted: Thu Oct 28, 2010 12:09 pm 
Newbie

Joined: Tue Oct 26, 2010 7:03 pm
Posts: 7
Good idea, I can do that, sounds easier than trying to figure out when hibernate is about to fill in an object with data and disabling events, then when its done re-enabling them. Thanks for all your help.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.