Changeset 5027


Ignore:
Timestamp:
Jul 28, 2009, 11:29:51 AM (14 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #1350: Update to Hibernate 3.3.2

Updated documentation.

Location:
trunk/doc/src/docbook
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/src/docbook/appendix/incompatible.xml

    r4920 r5027  
    4343    </para>
    4444  </note>
     45 
     46  <sect1 id="appendix.incompatible.2.13">
     47    <title>BASE 2.13 release</title>
     48
     49    <bridgehead>
     50      Reporters, Raw data, Features and Array design blocks are now proxied
     51    </bridgehead>
     52   
     53    <para>
     54      This was previously not possible due to a Hibernate problem with
     55      stateless sessions. See <ulink
     56      url="http://opensource.atlassian.com/projects/hibernate/browse/HHH-3528"
     57      >http://opensource.atlassian.com/projects/hibernate/browse/HHH-3528</ulink>
     58      for more information about this problem.
     59    </para>
     60   
     61    <para>
     62      This change means that items linking to reporter, raw data, feature or array design
     63      blocks will no longer load the linked items automatically. This is usually
     64      not a problem since the proxies will be initialised if needed. The exception
     65      is when a stateless session was used to create the proxy since the stateless
     66      can't initialise proxies. In BASE, stateless sessions are only used by <classname
     67      docapi="net.sf.based.core">DataQuery</classname> instances, eg. queries that
     68      returns reporter, raw data or features. When this type of query is used and
     69      when linked items are used in a way that causes proxy initialization the linked
     70      item must be explicitely FETCH JOIN-ed by the query. Here is an example:
     71    </para>
     72   
     73    <programlisting language="java"><![CDATA[
     74RawBioAssay rba = ...
     75DataQuery<RawData> rawQuery = rba.getRawData();
     76rawQuery.join(
     77  Hql.leftJoin(null, "reporter", Item.REPORTER.getAlias(), null, true));
     78// NOTE! Last parameter is 'true' to FETCH JOIN the reporter!!
     79...
     80DbControl dc = ...
     81DataResultIterator<RawData> rawData = rawQuery.iterate(dc);
     82while (rawData.hasNext())
     83{
     84  RawData rd = rawData.next();
     85  ReporterData reporter = rd.getReporter();
     86  int reporterId = reporter.getId();
     87  // Always safe since getId() doesn't cause proxy initialization
     88
     89  reporter.getName();
     90  // The above statement will fail in BASE 2.13 if
     91  // the FETCH JOIN is no included
     92  ....
     93}]]>
     94</programlisting>
     95 
     96    <para>
     97      The error message to look out for is:
     98      <code>
     99      org.hibernate.SessionException: proxies cannot be fetched by a stateless session
     100      </code>
     101    </para>
     102
     103  </sect1>
    45104 
    46105  <sect1 id="appendix.incompatible.2.12">
  • trunk/doc/src/docbook/developerdoc/core_ref.xml

    r4537 r5027  
    715715            is required that proxies are enabled for all items that are linked from any of
    716716            the batchable items, ie. <classname docapi="net.sf.basedb.core">RawBioAssay</classname>,
    717             <classname docapi="net.sf.basedb.core">ReporterType</classname>, <classname docapi="net.sf.basedb.core">ArrayDesignBlock</classname>, etc.
     717            <classname docapi="net.sf.basedb.core">ReporterType</classname>,
     718            <classname docapi="net.sf.basedb.core">ArrayDesignBlock</classname>, etc.
     719            If we don't do this Hibernate will generate multiple additional select
     720            statements for the same parent item which will affect performance
     721            in a bad way.
    718722          </para>
    719723         
     
    721725            On the other hand, the proxies created from a stateless session cannot later
    722726            be initialised. We have to get the ID from the proxy and the load the object
    723             using the regular session. This also means that a batchable class shouldn't
    724             use proxies.
     727            using the regular session. But this can also results in lots of additional select
     728            statements so if it is known before that we need some information it is recommended
     729            that a FETCH JOIN is used so that we get fully initialized objects instead of
     730            proxies to begin with.
    725731          </para>
    726732        </warning>
     
    797803        <para>
    798804          * = Do not use this setting for classes which are many-to-one linked from a batchable
    799           class. Always use this setting for batchable classes. See warning above!
     805          class.
    800806        </para>
    801807       
Note: See TracChangeset for help on using the changeset viewer.