Hi,
I'm fairly new to Hibernate and am having issues with Hibernate generating what are to me unnecessary sql statements.
It occurs when the retrieving collections of either components or associations and the use of "batch-size" option. The "batch-size" parameter does not work as documented. Internally, Hibernate generates a smallBatchSize which is the square root of the batch size.
The algorithm for retrieving a batch is then:
1. If the batch to retrieve is smaller than "smallBatchSize", retrieve one row at a time.
2. else if batch is smaller than "batch-size", retrieve "smallBatchSize" at a time
3. else if the batch is greater than "batch-size", retireve a "batch-size" items.
This algortihm is pretty much duplicated in BatchingEntityLoader and BatchingCollectionInitializer.
Why this algorithm? This generates a very large number of selects.
For example, if batch size is set to 100 and there are 79 rows to retrieve, Hibernate will generate
16 select statements to retrieve the rows. (As 79 is less than 100, it retrives in batches of the sqrt of 100 (10) to fetch 70 rows, then the last 9 individually).
What is the purpose of this algorithm? Can it be changed?
I've done a hack myself to BatchingCollectionInitializer to create a new Loader instance to load all rows when there is less than a whole batch remaining. The overhead of creating a new Loader seems insignificant compared to additional SQL statements. (The hack returns the results in a single select in the above example).
What I'm confused about is why the existing algorithm was implemented. Am I missing something fundamental? If not, will something along the lines of my hack be implemented soon?
Given my lack of experience with Hibernate, I'm not keen to patch it, but can't really live with it as is. Hopefully, I'm missing something.
Regards,
Andrew
Notes about the ouptut: the number of rows returned from the query is only 79. There are 2 collections, one of components (custom fields) and the other is a one-to-many association of links.
Hibernate version:
2.1.8
Mapping documents:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping
>
<class
name="somepackage.Ticket"
table="Tickets"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
>
<id
name="id"
column="id"
type="java.lang.Integer"
access="property"
>
<generator class="assigned">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-Ticket.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>
<property
name="effectiveId"
type="java.lang.Integer"
update="true"
insert="true"
access="property"
column="EffectiveId"
length="11"
not-null="true"
/>
<property
name="queue"
type="java.lang.Integer"
update="true"
insert="true"
access="property"
column="Queue"
length="11"
not-null="true"
/>
<property
name="type"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="Type"
length="16"
/>
<property
name="issueStatement"
type="java.lang.Integer"
update="true"
insert="true"
access="property"
column="IssueStatement"
length="11"
not-null="true"
/>
<property
name="resolution"
type="java.lang.Integer"
update="true"
insert="true"
access="property"
column="Resolution"
length="11"
not-null="true"
/>
<property
name="owner"
type="java.lang.Integer"
update="true"
insert="true"
access="property"
column="Owner"
length="11"
not-null="true"
/>
<property
name="subject"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="Subject"
length="200"
/>
<property
name="initialPriority"
type="int"
update="true"
insert="true"
access="property"
column="InitialPriority"
length="11"
not-null="true"
/>
<property
name="finalPriority"
type="int"
update="true"
insert="true"
access="property"
column="FinalPriority"
length="11"
not-null="true"
/>
<property
name="priority"
type="int"
update="true"
insert="true"
access="property"
column="Priority"
length="11"
not-null="true"
/>
<property
name="timeEstimated"
type="int"
update="true"
insert="true"
access="property"
column="TimeEstimated"
length="11"
not-null="true"
/>
<property
name="timeWorked"
type="int"
update="true"
insert="true"
access="property"
column="TimeWorked"
length="11"
not-null="true"
/>
<property
name="status"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="Status"
length="10"
/>
<property
name="timeLeft"
type="int"
update="true"
insert="true"
access="property"
column="TimeLeft"
length="11"
not-null="true"
/>
<property
name="told"
type="java.util.Date"
update="true"
insert="true"
access="property"
column="Told"
length="19"
/>
<property
name="starts"
type="java.util.Date"
update="true"
insert="true"
access="property"
column="Starts"
length="19"
/>
<property
name="started"
type="java.util.Date"
update="true"
insert="true"
access="property"
column="Started"
length="19"
/>
<property
name="due"
type="java.util.Date"
update="true"
insert="true"
access="property"
column="Due"
length="19"
/>
<property
name="resolved"
type="java.util.Date"
update="true"
insert="true"
access="property"
column="Resolved"
length="19"
/>
<property
name="lastUpdatedBy"
type="java.lang.Integer"
update="true"
insert="true"
access="property"
column="LastUpdatedBy"
length="11"
not-null="true"
/>
<property
name="lastUpdated"
type="java.util.Date"
update="true"
insert="true"
access="property"
column="LastUpdated"
length="19"
/>
<property
name="creator"
type="java.lang.Integer"
update="true"
insert="true"
access="property"
column="Creator"
length="11"
not-null="true"
/>
<property
name="created"
type="java.util.Date"
update="true"
insert="true"
access="property"
column="Created"
length="19"
/>
<property
name="disabled"
type="boolean"
update="true"
insert="true"
access="property"
column="Disabled"
not-null="true"
/>
<map
name="customFields"
table="TicketCustomFieldValues"
lazy="false"
sort="unsorted"
inverse="false"
cascade="none"
access="property"
batch-size="100"
>
<key
column="Ticket"
>
</key>
<index
column="id"
type="integer"
/>
<composite-element
class="somepackage.TicketCustomFieldValue"
>
<property
name="customField"
type="java.lang.Integer"
update="true"
insert="true"
access="property"
column="CustomField"
length="11"
not-null="true"
/>
<property
name="content"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="Content"
length="255"
/>
<property
name="creator"
type="java.lang.Integer"
update="true"
insert="true"
access="property"
column="Creator"
length="11"
not-null="true"
/>
<property
name="created"
type="java.util.Date"
update="true"
insert="true"
access="property"
column="Created"
length="19"
/>
<property
name="lastUpdatedBy"
type="java.lang.Integer"
update="true"
insert="true"
access="property"
column="LastUpdatedBy"
length="11"
not-null="true"
/>
<property
name="lastUpdated"
type="java.util.Date"
update="true"
insert="true"
access="property"
column="LastUpdated"
length="19"
/>
</composite-element>
</map>
<set
name="links"
lazy="false"
inverse="false"
cascade="none"
sort="unsorted"
access="property"
batch-size="100"
>
<key
column="LocalBase"
>
</key>
<one-to-many
class="somepackage.Link"
/>
</set>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Ticket.xml
containing the additional properties and place it in your merge dir.
-->
</class>
</hibernate-mapping>
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping
>
<class
name="somepackage.Link"
table="Links"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
batch-size="50"
>
<id
name="id"
column="id"
type="java.lang.Integer"
access="property"
>
<generator class="assigned">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-Link.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>
<property
name="base"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="Base"
length="240"
/>
<property
name="target"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="Target"
length="240"
/>
<property
name="type"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="Type"
length="20"
not-null="true"
/>
<property
name="localTarget"
type="int"
update="true"
insert="true"
access="property"
column="LocalTarget"
length="11"
not-null="true"
/>
<property
name="localBase"
type="int"
update="true"
insert="true"
access="property"
column="LocalBase"
length="11"
not-null="true"
/>
<property
name="lastUpdatedBy"
type="int"
update="true"
insert="true"
access="property"
column="LastUpdatedBy"
length="11"
not-null="true"
/>
<property
name="lastUpdated"
type="java.util.Date"
update="true"
insert="true"
access="property"
column="LastUpdated"
length="19"
/>
<property
name="creator"
type="int"
update="true"
insert="true"
access="property"
column="Creator"
length="11"
not-null="true"
/>
<property
name="created"
type="java.util.Date"
update="true"
insert="true"
access="property"
column="Created"
length="19"
/>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Link.xml
containing the additional properties and place it in your merge dir.
-->
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
List tickets = session.createCriteria(Ticket.class)
.add(Expression.in("status", new String[] {"new", "open", "stalled", "deleted"}))
.createCriteria("links").add(Expression.eq("target", "snbs://" + snbsCustomerId)).list();
Full stack trace of any exception that occurs:
N/A
Name and version of the database you are using:
Postgres 8.0.1
The generated SQL (show_sql=true):
Hibernate: select this.id as id1_, this.EffectiveId as Effectiv2_1_, this.Queue as Queue1_, this.Type as Type1_, this.IssueStatement as IssueSta5_1_, this.Resolution as Resolution1_, this.Owner as Owner1_, this.Subject as Subject1_, this.InitialPriority as InitialP9_1_, this.FinalPriority as FinalPr10_1_, this.Priority as Priority1_, this.TimeEstimated as TimeEst12_1_, this.TimeWorked as TimeWorked1_, this.Status as Status1_, this.TimeLeft as TimeLeft1_, this.Told as Told1_, this.Starts as Starts1_, this.Started as Started1_, this.Due as Due1_, this.Resolved as Resolved1_, this.LastUpdatedBy as LastUpd21_1_, this.LastUpdated as LastUpd22_1_, this.Creator as Creator1_, this.Created as Created1_, this.Disabled as Disabled1_, x0_.id as id0_, x0_.Base as Base0_, x0_.Target as Target0_, x0_.Type as Type0_, x0_.LocalTarget as LocalTar5_0_, x0_.LocalBase as LocalBase0_, x0_.LastUpdatedBy as LastUpda7_0_, x0_.LastUpdated as LastUpda8_0_, x0_.Creator as Creator0_, x0_.Created as Created0_ from Tickets this inner join Links x0_ on this.id=x0_.LocalBase where this.Status in (?, ?, ?, ?) and x0_.Target=?
Hibernate: select links0_.LocalBase as LocalBase__, links0_.id as id__, links0_.id as id0_, links0_.Base as Base0_, links0_.Target as Target0_, links0_.Type as Type0_, links0_.LocalTarget as LocalTar5_0_, links0_.LocalBase as LocalBase0_, links0_.LastUpdatedBy as LastUpda7_0_, links0_.LastUpdated as LastUpda8_0_, links0_.Creator as Creator0_, links0_.Created as Created0_ from Links links0_ where ((links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?))
Hibernate: select customfiel0_.Ticket as Ticket__, customfiel0_.CustomField as CustomFi2___, customfiel0_.Content as Content__, customfiel0_.Creator as Creator__, customfiel0_.Created as Created__, customfiel0_.LastUpdatedBy as LastUpda6___, customfiel0_.LastUpdated as LastUpda7___, customfiel0_.id as id__ from TicketCustomFieldValues customfiel0_ where ((customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?))
Hibernate: select links0_.LocalBase as LocalBase__, links0_.id as id__, links0_.id as id0_, links0_.Base as Base0_, links0_.Target as Target0_, links0_.Type as Type0_, links0_.LocalTarget as LocalTar5_0_, links0_.LocalBase as LocalBase0_, links0_.LastUpdatedBy as LastUpda7_0_, links0_.LastUpdated as LastUpda8_0_, links0_.Creator as Creator0_, links0_.Created as Created0_ from Links links0_ where ((links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?))
Hibernate: select customfiel0_.Ticket as Ticket__, customfiel0_.CustomField as CustomFi2___, customfiel0_.Content as Content__, customfiel0_.Creator as Creator__, customfiel0_.Created as Created__, customfiel0_.LastUpdatedBy as LastUpda6___, customfiel0_.LastUpdated as LastUpda7___, customfiel0_.id as id__ from TicketCustomFieldValues customfiel0_ where ((customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?))
Hibernate: select links0_.LocalBase as LocalBase__, links0_.id as id__, links0_.id as id0_, links0_.Base as Base0_, links0_.Target as Target0_, links0_.Type as Type0_, links0_.LocalTarget as LocalTar5_0_, links0_.LocalBase as LocalBase0_, links0_.LastUpdatedBy as LastUpda7_0_, links0_.LastUpdated as LastUpda8_0_, links0_.Creator as Creator0_, links0_.Created as Created0_ from Links links0_ where ((links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?))
Hibernate: select customfiel0_.Ticket as Ticket__, customfiel0_.CustomField as CustomFi2___, customfiel0_.Content as Content__, customfiel0_.Creator as Creator__, customfiel0_.Created as Created__, customfiel0_.LastUpdatedBy as LastUpda6___, customfiel0_.LastUpdated as LastUpda7___, customfiel0_.id as id__ from TicketCustomFieldValues customfiel0_ where ((customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?))
Hibernate: select links0_.LocalBase as LocalBase__, links0_.id as id__, links0_.id as id0_, links0_.Base as Base0_, links0_.Target as Target0_, links0_.Type as Type0_, links0_.LocalTarget as LocalTar5_0_, links0_.LocalBase as LocalBase0_, links0_.LastUpdatedBy as LastUpda7_0_, links0_.LastUpdated as LastUpda8_0_, links0_.Creator as Creator0_, links0_.Created as Created0_ from Links links0_ where ((links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?))
Hibernate: select customfiel0_.Ticket as Ticket__, customfiel0_.CustomField as CustomFi2___, customfiel0_.Content as Content__, customfiel0_.Creator as Creator__, customfiel0_.Created as Created__, customfiel0_.LastUpdatedBy as LastUpda6___, customfiel0_.LastUpdated as LastUpda7___, customfiel0_.id as id__ from TicketCustomFieldValues customfiel0_ where ((customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?))
Hibernate: select links0_.LocalBase as LocalBase__, links0_.id as id__, links0_.id as id0_, links0_.Base as Base0_, links0_.Target as Target0_, links0_.Type as Type0_, links0_.LocalTarget as LocalTar5_0_, links0_.LocalBase as LocalBase0_, links0_.LastUpdatedBy as LastUpda7_0_, links0_.LastUpdated as LastUpda8_0_, links0_.Creator as Creator0_, links0_.Created as Created0_ from Links links0_ where ((links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?))
Hibernate: select customfiel0_.Ticket as Ticket__, customfiel0_.CustomField as CustomFi2___, customfiel0_.Content as Content__, customfiel0_.Creator as Creator__, customfiel0_.Created as Created__, customfiel0_.LastUpdatedBy as LastUpda6___, customfiel0_.LastUpdated as LastUpda7___, customfiel0_.id as id__ from TicketCustomFieldValues customfiel0_ where ((customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?))
Hibernate: select links0_.LocalBase as LocalBase__, links0_.id as id__, links0_.id as id0_, links0_.Base as Base0_, links0_.Target as Target0_, links0_.Type as Type0_, links0_.LocalTarget as LocalTar5_0_, links0_.LocalBase as LocalBase0_, links0_.LastUpdatedBy as LastUpda7_0_, links0_.LastUpdated as LastUpda8_0_, links0_.Creator as Creator0_, links0_.Created as Created0_ from Links links0_ where ((links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?))
Hibernate: select customfiel0_.Ticket as Ticket__, customfiel0_.CustomField as CustomFi2___, customfiel0_.Content as Content__, customfiel0_.Creator as Creator__, customfiel0_.Created as Created__, customfiel0_.LastUpdatedBy as LastUpda6___, customfiel0_.LastUpdated as LastUpda7___, customfiel0_.id as id__ from TicketCustomFieldValues customfiel0_ where ((customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?))
Hibernate: select links0_.LocalBase as LocalBase__, links0_.id as id__, links0_.id as id0_, links0_.Base as Base0_, links0_.Target as Target0_, links0_.Type as Type0_, links0_.LocalTarget as LocalTar5_0_, links0_.LocalBase as LocalBase0_, links0_.LastUpdatedBy as LastUpda7_0_, links0_.LastUpdated as LastUpda8_0_, links0_.Creator as Creator0_, links0_.Created as Created0_ from Links links0_ where ((links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?) or (links0_.LocalBase=?))
Hibernate: select customfiel0_.Ticket as Ticket__, customfiel0_.CustomField as CustomFi2___, customfiel0_.Content as Content__, customfiel0_.Creator as Creator__, customfiel0_.Created as Created__, customfiel0_.LastUpdatedBy as LastUpda6___, customfiel0_.LastUpdated as LastUpda7___, customfiel0_.id as id__ from TicketCustomFieldValues customfiel0_ where ((customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?) or (customfiel0_.Ticket=?))
Hibernate: select links0_.LocalBase as LocalBase__, links0_.id as id__, links0_.id as id0_, links0_.Base as Base0_, links0_.Target as Target0_, links0_.Type as Type0_, links0_.LocalTarget as LocalTar5_0_, links0_.LocalBase as LocalBase0_, links0_.LastUpdatedBy as LastUpda7_0_, links0_.LastUpdated as LastUpda8_0_, links0_.Creator as Creator0_, links0_.Created as Created0_ from Links links0_ where links0_.LocalBase=?
Hibernate: select customfiel0_.Ticket as Ticket__, customfiel0_.CustomField as CustomFi2___, customfiel0_.Content as Content__, customfiel0_.Creator as Creator__, customfiel0_.Created as Created__, customfiel0_.LastUpdatedBy as LastUpda6___, customfiel0_.LastUpdated as LastUpda7___, customfiel0_.id as id__ from TicketCustomFieldValues customfiel0_ where customfiel0_.Ticket=?
Hibernate: select links0_.LocalBase as LocalBase__, links0_.id as id__, links0_.id as id0_, links0_.Base as Base0_, links0_.Target as Target0_, links0_.Type as Type0_, links0_.LocalTarget as LocalTar5_0_, links0_.LocalBase as LocalBase0_, links0_.LastUpdatedBy as LastUpda7_0_, links0_.LastUpdated as LastUpda8_0_, links0_.Creator as Creator0_, links0_.Created as Created0_ from Links links0_ where links0_.LocalBase=?
Hibernate: select customfiel0_.Ticket as Ticket__, customfiel0_.CustomField as CustomFi2___, customfiel0_.Content as Content__, customfiel0_.Creator as Creator__, customfiel0_.Created as Created__, customfiel0_.LastUpdatedBy as LastUpda6___, customfiel0_.LastUpdated as LastUpda7___, customfiel0_.id as id__ from TicketCustomFieldValues customfiel0_ where customfiel0_.Ticket=?
Hibernate: select links0_.LocalBase as LocalBase__, links0_.id as id__, links0_.id as id0_, links0_.Base as Base0_, links0_.Target as Target0_, links0_.Type as Type0_, links0_.LocalTarget as LocalTar5_0_, links0_.LocalBase as LocalBase0_, links0_.LastUpdatedBy as LastUpda7_0_, links0_.LastUpdated as LastUpda8_0_, links0_.Creator as Creator0_, links0_.Created as Created0_ from Links links0_ where links0_.LocalBase=?
Hibernate: select customfiel0_.Ticket as Ticket__, customfiel0_.CustomField as CustomFi2___, customfiel0_.Content as Content__, customfiel0_.Creator as Creator__, customfiel0_.Created as Created__, customfiel0_.LastUpdatedBy as LastUpda6___, customfiel0_.LastUpdated as LastUpda7___, customfiel0_.id as id__ from TicketCustomFieldValues customfiel0_ where customfiel0_.Ticket=?
Hibernate: select links0_.LocalBase as LocalBase__, links0_.id as id__, links0_.id as id0_, links0_.Base as Base0_, links0_.Target as Target0_, links0_.Type as Type0_, links0_.LocalTarget as LocalTar5_0_, links0_.LocalBase as LocalBase0_, links0_.LastUpdatedBy as LastUpda7_0_, links0_.LastUpdated as LastUpda8_0_, links0_.Creator as Creator0_, links0_.Created as Created0_ from Links links0_ where links0_.LocalBase=?
Hibernate: select customfiel0_.Ticket as Ticket__, customfiel0_.CustomField as CustomFi2___, customfiel0_.Content as Content__, customfiel0_.Creator as Creator__, customfiel0_.Created as Created__, customfiel0_.LastUpdatedBy as LastUpda6___, customfiel0_.LastUpdated as LastUpda7___, customfiel0_.id as id__ from TicketCustomFieldValues customfiel0_ where customfiel0_.Ticket=?
Hibernate: select links0_.LocalBase as LocalBase__, links0_.id as id__, links0_.id as id0_, links0_.Base as Base0_, links0_.Target as Target0_, links0_.Type as Type0_, links0_.LocalTarget as LocalTar5_0_, links0_.LocalBase as LocalBase0_, links0_.LastUpdatedBy as LastUpda7_0_, links0_.LastUpdated as LastUpda8_0_, links0_.Creator as Creator0_, links0_.Created as Created0_ from Links links0_ where links0_.LocalBase=?
Hibernate: select customfiel0_.Ticket as Ticket__, customfiel0_.CustomField as CustomFi2___, customfiel0_.Content as Content__, customfiel0_.Creator as Creator__, customfiel0_.Created as Created__, customfiel0_.LastUpdatedBy as LastUpda6___, customfiel0_.LastUpdated as LastUpda7___, customfiel0_.id as id__ from TicketCustomFieldValues customfiel0_ where customfiel0_.Ticket=?
Hibernate: select links0_.LocalBase as LocalBase__, links0_.id as id__, links0_.id as id0_, links0_.Base as Base0_, links0_.Target as Target0_, links0_.Type as Type0_, links0_.LocalTarget as LocalTar5_0_, links0_.LocalBase as LocalBase0_, links0_.LastUpdatedBy as LastUpda7_0_, links0_.LastUpdated as LastUpda8_0_, links0_.Creator as Creator0_, links0_.Created as Created0_ from Links links0_ where links0_.LocalBase=?
Hibernate: select customfiel0_.Ticket as Ticket__, customfiel0_.CustomField as CustomFi2___, customfiel0_.Content as Content__, customfiel0_.Creator as Creator__, customfiel0_.Created as Created__, customfiel0_.LastUpdatedBy as LastUpda6___, customfiel0_.LastUpdated as LastUpda7___, customfiel0_.id as id__ from TicketCustomFieldValues customfiel0_ where customfiel0_.Ticket=?
Hibernate: select links0_.LocalBase as LocalBase__, links0_.id as id__, links0_.id as id0_, links0_.Base as Base0_, links0_.Target as Target0_, links0_.Type as Type0_, links0_.LocalTarget as LocalTar5_0_, links0_.LocalBase as LocalBase0_, links0_.LastUpdatedBy as LastUpda7_0_, links0_.LastUpdated as LastUpda8_0_, links0_.Creator as Creator0_, links0_.Created as Created0_ from Links links0_ where links0_.LocalBase=?
Hibernate: select customfiel0_.Ticket as Ticket__, customfiel0_.CustomField as CustomFi2___, customfiel0_.Content as Content__, customfiel0_.Creator as Creator__, customfiel0_.Created as Created__, customfiel0_.LastUpdatedBy as LastUpda6___, customfiel0_.LastUpdated as LastUpda7___, customfiel0_.id as id__ from TicketCustomFieldValues customfiel0_ where customfiel0_.Ticket=?
Hibernate: select links0_.LocalBase as LocalBase__, links0_.id as id__, links0_.id as id0_, links0_.Base as Base0_, links0_.Target as Target0_, links0_.Type as Type0_, links0_.LocalTarget as LocalTar5_0_, links0_.LocalBase as LocalBase0_, links0_.LastUpdatedBy as LastUpda7_0_, links0_.LastUpdated as LastUpda8_0_, links0_.Creator as Creator0_, links0_.Created as Created0_ from Links links0_ where links0_.LocalBase=?
Hibernate: select customfiel0_.Ticket as Ticket__, customfiel0_.CustomField as CustomFi2___, customfiel0_.Content as Content__, customfiel0_.Creator as Creator__, customfiel0_.Created as Created__, customfiel0_.LastUpdatedBy as LastUpda6___, customfiel0_.LastUpdated as LastUpda7___, customfiel0_.id as id__ from TicketCustomFieldValues customfiel0_ where customfiel0_.Ticket=?
Hibernate: select links0_.LocalBase as LocalBase__, links0_.id as id__, links0_.id as id0_, links0_.Base as Base0_, links0_.Target as Target0_, links0_.Type as Type0_, links0_.LocalTarget as LocalTar5_0_, links0_.LocalBase as LocalBase0_, links0_.LastUpdatedBy as LastUpda7_0_, links0_.LastUpdated as LastUpda8_0_, links0_.Creator as Creator0_, links0_.Created as Created0_ from Links links0_ where links0_.LocalBase=?
Hibernate: select customfiel0_.Ticket as Ticket__, customfiel0_.CustomField as CustomFi2___, customfiel0_.Content as Content__, customfiel0_.Creator as Creator__, customfiel0_.Created as Created__, customfiel0_.LastUpdatedBy as LastUpda6___, customfiel0_.LastUpdated as LastUpda7___, customfiel0_.id as id__ from TicketCustomFieldValues customfiel0_ where customfiel0_.Ticket=?
Debug level Hibernate log excerpt:
These statements show how "smallBatchSize" is being used
DEBUG [main] BatchingCollectionInitializer: batch loading collection role (small batch): somepackage.Ticket.links
DEBUG [main] BatchingCollectionInitializer: batch loading collection role (small batch): somepackage.Ticket.customFields
DEBUG [main] BatchingCollectionInitializer: batch loading collection role (small batch): somepackage.Ticket.links
DEBUG [main] BatchingCollectionInitializer: batch loading collection role (small batch): somepackage.Ticket.customFields
DEBUG [main] BatchingCollectionInitializer: batch loading collection role (small batch): somepackage.Ticket.links
DEBUG [main] BatchingCollectionInitializer: batch loading collection role (small batch): somepackage.Ticket.customFields
DEBUG [main] BatchingCollectionInitializer: batch loading collection role (small batch): somepackage.Ticket.links
DEBUG [main] BatchingCollectionInitializer: batch loading collection role (small batch): somepackage.Ticket.customFields
DEBUG [main] BatchingCollectionInitializer: batch loading collection role (small batch): somepackage.Ticket.links
DEBUG [main] BatchingCollectionInitializer: batch loading collection role (small batch): somepackage.Ticket.customFields
DEBUG [main] BatchingCollectionInitializer: batch loading collection role (small batch): somepackage.Ticket.links
DEBUG [main] BatchingCollectionInitializer: batch loading collection role (small batch): somepackage.Ticket.customFields
DEBUG [main] BatchingCollectionInitializer: batch loading collection role (small batch): somepackage.Ticket.links
DEBUG [main] BatchingCollectionInitializer: batch loading collection role (small batch): somepackage.Ticket.customFields