-->
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.  [ 5 posts ] 
Author Message
 Post subject: Left join fetch question
PostPosted: Wed Sep 15, 2004 10:25 pm 
Beginner
Beginner

Joined: Sat May 01, 2004 2:44 am
Posts: 32
Location: Brisbane, Australia
Hi Guys,

I'm having a strange problem with using left join fetch to initialise a collection along with a parent. I'm unsure whether the problem is my misunderstanding or a bug.

I'm calling a HQL query that loads all records of class JobType. The HQL query also calls 'left join fetch' to initialise a child collection (service types) within the same query.

The problem I'm having is that this query returns duplicates of the JobType instances - one for every ServiceType child in the associated collection. This is the behaviour I expect from an SQL left outer join, but I was under the impression from the doco that left join fetch only initialises the collection or associated entity, but still returns unique instances of the primary entity.

Any help would be appreciated.

Scott


Hibernate version:
1.6

Mapping documents:

<class name="com.itglovebox.smartmove.tpt.ref.JobType" table="oxcjobtr">
<cache usage="nonstrict-read-write"/>

<id name="jobType" column="job_type" type="com.itglovebox.hibernate.type.TrimStringType">
<generator class="assigned"/>
</id>

<property name="description" column="description" type="com.itglovebox.hibernate.type.TrimStringType"/>

<set name="serviceTypes" inverse="true" lazy="true" order-by="service_type asc">
<key column="job_type"/>
<one-to-many class="com.itglovebox.smartmove.tpt.ref.ServiceType" />
</set>

</class>

<class name="com.itglovebox.smartmove.tpt.ref.ServiceType" table="oxcsertr">
<cache usage="nonstrict-read-write"/>

<id name="serviceType" column="service_type" type="com.itglovebox.hibernate.type.TrimStringType">
<generator class="assigned"/>
</id>

<property name="description" column="description" type="com.itglovebox.hibernate.type.TrimStringType"/>
<property name="cubicConversion" column="cube_conv" type="com.itglovebox.hibernate.type.DoubleType"/>
<property name="glAccount" column="gl_acct" type="com.itglovebox.hibernate.type.TrimStringType"/>
<property name="chargeBy" column="charge_by" type="com.itglovebox.hibernate.type.TrimStringType"/>
<property name="freightClassReq" column="fr_class_req" type="com.itglovebox.hibernate.type.TrimStringType"/>

<many-to-one name="jobType" column="job_type" outer-join="false"/>

<set name="priorityTypes" inverse="true" lazy="true" order-by="priority_code asc">
<key column="service"/>
<one-to-many class="com.itglovebox.smartmove.tpt.ref.PriorityType" />
</set>

</class>

<class name="com.itglovebox.smartmove.tpt.ref.PriorityType" table="oxcpritr">
<cache usage="nonstrict-read-write"/>

<id name="priorityCode" column="priority_code" type="com.itglovebox.hibernate.type.TrimStringType">
<generator class="assigned"/>
</id>

<property name="description" column="description" type="com.itglovebox.hibernate.type.TrimStringType"/>
<property name="level" column="level" type="com.itglovebox.hibernate.type.IntegerType"/>

<many-to-one name="serviceType" column="service" outer-join="false"/>

</class>


Code between sessionFactory.openSession() and session.close():

public List getJobTypes() throws Exception
{
return getHibernateTemplate().find(fetchJobAndServiceTypesString);
}

private static final String fetchJobAndServiceTypesString =
"FROM " + JobType.class.getName() + " AS jt "
+ "LEFT JOIN FETCH jt.serviceTypes";



Full stack trace of any exception that occurs:
N/A

Name and version of the database you are using:
Informix 7.3

The generated SQL (show_sql=true):

select jobtype0_.job_type as job_type0_, servicetyp1_.service_type as service_1_1_, jobtype0_.description as descript2_0_, servicetyp1_.description as descript2_1_, servicetyp1_.cube_conv as cube_conv1_, servicetyp1_.gl_acct as gl_acct1_, servicetyp1_.charge_by as charge_by1_, servicetyp1_.fr_class_req as fr_class6_1_, servicetyp1_.job_type as job_type1_, servicetyp1_.job_type as job_type__, servicetyp1_.service_type as service_1___ from oxcjobtr jobtype0_ left outer join oxcsertr servicetyp1_ on jobtype0_.job_type=servicetyp1_.job_type order by servicetyp1_.service_type asc


Debug level Hibernate log excerpt:

2004-09-16 11:48:04,392 DEBUG [http-8080-Processor24] hibernate.SessionFactoryUtils - Opening Hibernate session
2004-09-16 11:48:04,392 DEBUG [http-8080-Processor24] impl.SessionImpl - opened session
2004-09-16 11:48:04,392 DEBUG [http-8080-Processor24] hibernate.HibernateInterceptor - Using new session for Hibernate interceptor
2004-09-16 11:48:04,392 DEBUG [http-8080-Processor24] support.TransactionSynchronizationManager - Bound value [org.springframework.orm.hibernate.SessionHolder@1d1f4fe] for key [net.sf.hibernate.impl.SessionFactoryImpl@95b0a3] to thread [http-8080-Processor24]
2004-09-16 11:50:59,904 DEBUG [http-8080-Processor24] support.TransactionSynchronizationManager - Retrieved value [org.springframework.orm.hibernate.SessionHolder@1d1f4fe] for key [net.sf.hibernate.impl.SessionFactoryImpl@95b0a3] bound to thread [http-8080-Processor24]
2004-09-16 11:50:59,965 DEBUG [http-8080-Processor24] support.TransactionSynchronizationManager - Retrieved value [org.springframework.orm.hibernate.SessionHolder@1d1f4fe] for key [net.sf.hibernate.impl.SessionFactoryImpl@95b0a3] bound to thread [http-8080-Processor24]
2004-09-16 11:50:59,965 DEBUG [http-8080-Processor24] impl.SessionImpl - find: FROM com.itglovebox.smartmove.tpt.ref.JobType AS jt LEFT JOIN FETCH jt.serviceTypes
2004-09-16 11:50:59,965 DEBUG [http-8080-Processor24] engine.QueryParameters - named parameters: {}
2004-09-16 11:50:59,965 DEBUG [http-8080-Processor24] hql.QueryTranslator - compiling query
2004-09-16 11:50:59,965 DEBUG [http-8080-Processor24] impl.SessionImpl - flushing session
2004-09-16 11:50:59,965 DEBUG [http-8080-Processor24] impl.SessionImpl - Flushing entities and processing referenced collections
2004-09-16 11:50:59,965 DEBUG [http-8080-Processor24] impl.SessionImpl - Processing unreferenced collections
2004-09-16 11:50:59,965 DEBUG [http-8080-Processor24] impl.SessionImpl - Scheduling collection removes/(re)creates/updates
2004-09-16 11:50:59,965 DEBUG [http-8080-Processor24] impl.SessionImpl - Flushed: 0 insertions, 0 updates, 0 deletions to 0 objects
2004-09-16 11:50:59,965 DEBUG [http-8080-Processor24] impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
2004-09-16 11:50:59,965 DEBUG [http-8080-Processor24] impl.SessionImpl - Dont need to execute flush
2004-09-16 11:50:59,965 DEBUG [http-8080-Processor24] hql.QueryTranslator - HQL: FROM com.itglovebox.smartmove.tpt.ref.JobType AS jt LEFT JOIN FETCH jt.serviceTypes
2004-09-16 11:50:59,975 DEBUG [http-8080-Processor24] hql.QueryTranslator - SQL: select jobtype0_.job_type as job_type0_, servicetyp1_.service_type as service_1_1_, jobtype0_.description as descript2_0_, servicetyp1_.description as descript2_1_, servicetyp1_.cube_conv as cube_conv1_, servicetyp1_.gl_acct as gl_acct1_, servicetyp1_.charge_by as charge_by1_, servicetyp1_.fr_class_req as fr_class6_1_, servicetyp1_.job_type as job_type1_, servicetyp1_.job_type as job_type__, servicetyp1_.service_type as service_1___ from oxcjobtr jobtype0_ left outer join oxcsertr servicetyp1_ on jobtype0_.job_type=servicetyp1_.job_type order by servicetyp1_.service_type asc
2004-09-16 11:50:59,975 DEBUG [http-8080-Processor24] impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
2004-09-16 11:50:59,975 DEBUG [http-8080-Processor24] connection.DriverManagerConnectionProvider - total checked-out connections: 0
2004-09-16 11:50:59,975 DEBUG [http-8080-Processor24] connection.DriverManagerConnectionProvider - using pooled JDBC connection, pool size: 0
2004-09-16 11:50:59,975 DEBUG [http-8080-Processor24] hibernate.SQL - select jobtype0_.job_type as job_type0_, servicetyp1_.service_type as service_1_1_, jobtype0_.description as descript2_0_, servicetyp1_.description as descript2_1_, servicetyp1_.cube_conv as cube_conv1_, servicetyp1_.gl_acct as gl_acct1_, servicetyp1_.charge_by as charge_by1_, servicetyp1_.fr_class_req as fr_class6_1_, servicetyp1_.job_type as job_type1_, servicetyp1_.job_type as job_type__, servicetyp1_.service_type as service_1___ from oxcjobtr jobtype0_ left outer join oxcsertr servicetyp1_ on jobtype0_.job_type=servicetyp1_.job_type order by servicetyp1_.service_type asc
2004-09-16 11:50:59,975 DEBUG [http-8080-Processor24] impl.BatcherImpl - preparing statement
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] loader.Loader - processing result set
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] loader.Loader - result row: TT, null
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] loader.Loader - Initializing object from ResultSet: TT
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] loader.Loader - Hydrating entity: com.itglovebox.smartmove.tpt.ref.JobType#TT
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] loader.Loader - result set contains (possibly empty) collection: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#TT]
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] impl.SessionImpl - new collection: instantiating
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] loader.Loader - result row: COUR, null
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] loader.Loader - Initializing object from ResultSet: COUR
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] loader.Loader - Hydrating entity: com.itglovebox.smartmove.tpt.ref.JobType#COUR
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] loader.Loader - result set contains (possibly empty) collection: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#COUR]
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] impl.SessionImpl - new collection: instantiating
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] loader.Loader - result row: LOGI, null
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] loader.Loader - Initializing object from ResultSet: LOGI
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] loader.Loader - Hydrating entity: com.itglovebox.smartmove.tpt.ref.JobType#LOGI
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] loader.Loader - result set contains (possibly empty) collection: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#LOGI]
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] impl.SessionImpl - new collection: instantiating
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] loader.Loader - result row: GEN, EXP
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] loader.Loader - Initializing object from ResultSet: GEN
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] loader.Loader - Hydrating entity: com.itglovebox.smartmove.tpt.ref.JobType#GEN
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] loader.Loader - Initializing object from ResultSet: EXP
2004-09-16 11:51:00,285 DEBUG [http-8080-Processor24] loader.Loader - Hydrating entity: com.itglovebox.smartmove.tpt.ref.ServiceType#EXP
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - found row of collection: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#GEN]
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] impl.SessionImpl - new collection: instantiating
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] impl.SessionImpl - loading [com.itglovebox.smartmove.tpt.ref.ServiceType#EXP]
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] impl.SessionImpl - attempting to resolve [com.itglovebox.smartmove.tpt.ref.ServiceType#EXP]
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] impl.SessionImpl - resolved object in session cache [com.itglovebox.smartmove.tpt.ref.ServiceType#EXP]
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - result row: PUP, ISTATE
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - Initializing object from ResultSet: PUP
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - Hydrating entity: com.itglovebox.smartmove.tpt.ref.JobType#PUP
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - Initializing object from ResultSet: ISTATE
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - Hydrating entity: com.itglovebox.smartmove.tpt.ref.ServiceType#ISTATE
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - found row of collection: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#PUP]
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] impl.SessionImpl - new collection: instantiating
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] impl.SessionImpl - loading [com.itglovebox.smartmove.tpt.ref.ServiceType#ISTATE]
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] impl.SessionImpl - attempting to resolve [com.itglovebox.smartmove.tpt.ref.ServiceType#ISTATE]
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] impl.SessionImpl - resolved object in session cache [com.itglovebox.smartmove.tpt.ref.ServiceType#ISTATE]
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - result row: GEN, LOC
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - Initializing object from ResultSet: LOC
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - Hydrating entity: com.itglovebox.smartmove.tpt.ref.ServiceType#LOC
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - found row of collection: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#GEN]
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] impl.SessionImpl - reading row
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] impl.SessionImpl - loading [com.itglovebox.smartmove.tpt.ref.ServiceType#LOC]
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] impl.SessionImpl - attempting to resolve [com.itglovebox.smartmove.tpt.ref.ServiceType#LOC]
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] impl.SessionImpl - resolved object in session cache [com.itglovebox.smartmove.tpt.ref.ServiceType#LOC]
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - result row: PUP, METRO
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - Initializing object from ResultSet: METRO
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - Hydrating entity: com.itglovebox.smartmove.tpt.ref.ServiceType#METRO
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - found row of collection: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#PUP]
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] impl.SessionImpl - reading row
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] impl.SessionImpl - loading [com.itglovebox.smartmove.tpt.ref.ServiceType#METRO]
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] impl.SessionImpl - attempting to resolve [com.itglovebox.smartmove.tpt.ref.ServiceType#METRO]
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] impl.SessionImpl - resolved object in session cache [com.itglovebox.smartmove.tpt.ref.ServiceType#METRO]
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - result row: GEN, STO
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - Initializing object from ResultSet: STO
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - Hydrating entity: com.itglovebox.smartmove.tpt.ref.ServiceType#STO
2004-09-16 11:51:00,295 DEBUG [http-8080-Processor24] loader.Loader - found row of collection: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#GEN]
2004-09-16 11:51:00,305 DEBUG [http-8080-Processor24] impl.SessionImpl - reading row
2004-09-16 11:51:00,305 DEBUG [http-8080-Processor24] impl.SessionImpl - loading [com.itglovebox.smartmove.tpt.ref.ServiceType#STO]
2004-09-16 11:51:00,305 DEBUG [http-8080-Processor24] impl.SessionImpl - attempting to resolve [com.itglovebox.smartmove.tpt.ref.ServiceType#STO]
2004-09-16 11:51:00,305 DEBUG [http-8080-Processor24] impl.SessionImpl - resolved object in session cache [com.itglovebox.smartmove.tpt.ref.ServiceType#STO]
2004-09-16 11:51:00,305 DEBUG [http-8080-Processor24] loader.Loader - result row: GEN, TAX
2004-09-16 11:51:00,305 DEBUG [http-8080-Processor24] loader.Loader - Initializing object from ResultSet: TAX
2004-09-16 11:51:00,305 DEBUG [http-8080-Processor24] loader.Loader - Hydrating entity: com.itglovebox.smartmove.tpt.ref.ServiceType#TAX
2004-09-16 11:51:00,305 DEBUG [http-8080-Processor24] loader.Loader - found row of collection: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#GEN]
2004-09-16 11:51:00,305 DEBUG [http-8080-Processor24] impl.SessionImpl - reading row
2004-09-16 11:51:00,305 DEBUG [http-8080-Processor24] impl.SessionImpl - loading [com.itglovebox.smartmove.tpt.ref.ServiceType#TAX]
2004-09-16 11:51:00,305 DEBUG [http-8080-Processor24] impl.SessionImpl - attempting to resolve [com.itglovebox.smartmove.tpt.ref.ServiceType#TAX]
2004-09-16 11:51:00,305 DEBUG [http-8080-Processor24] impl.SessionImpl - resolved object in session cache [com.itglovebox.smartmove.tpt.ref.ServiceType#TAX]
2004-09-16 11:51:00,395 DEBUG [http-8080-Processor24] loader.Loader - done processing result set (9 rows)
2004-09-16 11:51:00,475 DEBUG [http-8080-Processor24] impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
2004-09-16 11:51:00,475 DEBUG [http-8080-Processor24] impl.BatcherImpl - closing statement
2004-09-16 11:51:00,535 DEBUG [http-8080-Processor24] loader.Loader - total objects hydrated: 11
2004-09-16 11:51:00,535 DEBUG [http-8080-Processor24] impl.SessionImpl - resolving associations for [com.itglovebox.smartmove.tpt.ref.JobType#TT]
2004-09-16 11:51:00,535 DEBUG [http-8080-Processor24] impl.SessionImpl - returning loading collection:[com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#TT]
2004-09-16 11:51:00,535 DEBUG [http-8080-Processor24] impl.SessionImpl - adding entity to second-level cache [com.itglovebox.smartmove.tpt.ref.JobType#TT]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] cache.NonstrictReadWriteCache - Caching: TT
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - done materializing entity [com.itglovebox.smartmove.tpt.ref.JobType#TT]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - resolving associations for [com.itglovebox.smartmove.tpt.ref.JobType#COUR]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - returning loading collection:[com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#COUR]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - adding entity to second-level cache [com.itglovebox.smartmove.tpt.ref.JobType#COUR]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] cache.NonstrictReadWriteCache - Caching: COUR
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - done materializing entity [com.itglovebox.smartmove.tpt.ref.JobType#COUR]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - resolving associations for [com.itglovebox.smartmove.tpt.ref.JobType#LOGI]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - returning loading collection:[com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#LOGI]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - adding entity to second-level cache [com.itglovebox.smartmove.tpt.ref.JobType#LOGI]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] cache.NonstrictReadWriteCache - Caching: LOGI
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - done materializing entity [com.itglovebox.smartmove.tpt.ref.JobType#LOGI]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - resolving associations for [com.itglovebox.smartmove.tpt.ref.JobType#GEN]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - returning loading collection:[com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#GEN]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - adding entity to second-level cache [com.itglovebox.smartmove.tpt.ref.JobType#GEN]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] cache.NonstrictReadWriteCache - Caching: GEN
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - done materializing entity [com.itglovebox.smartmove.tpt.ref.JobType#GEN]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - resolving associations for [com.itglovebox.smartmove.tpt.ref.ServiceType#EXP]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - loading [com.itglovebox.smartmove.tpt.ref.JobType#GEN]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - attempting to resolve [com.itglovebox.smartmove.tpt.ref.JobType#GEN]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - resolved object in session cache [com.itglovebox.smartmove.tpt.ref.JobType#GEN]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - creating collection wrapper:[com.itglovebox.smartmove.tpt.ref.ServiceType.priorityTypes#EXP]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - adding entity to second-level cache [com.itglovebox.smartmove.tpt.ref.ServiceType#EXP]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] cache.NonstrictReadWriteCache - Caching: EXP
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - done materializing entity [com.itglovebox.smartmove.tpt.ref.ServiceType#EXP]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - resolving associations for [com.itglovebox.smartmove.tpt.ref.JobType#PUP]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - returning loading collection:[com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#PUP]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - adding entity to second-level cache [com.itglovebox.smartmove.tpt.ref.JobType#PUP]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] cache.NonstrictReadWriteCache - Caching: PUP
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - done materializing entity [com.itglovebox.smartmove.tpt.ref.JobType#PUP]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - resolving associations for [com.itglovebox.smartmove.tpt.ref.ServiceType#ISTATE]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - loading [com.itglovebox.smartmove.tpt.ref.JobType#PUP]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - attempting to resolve [com.itglovebox.smartmove.tpt.ref.JobType#PUP]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - resolved object in session cache [com.itglovebox.smartmove.tpt.ref.JobType#PUP]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - creating collection wrapper:[com.itglovebox.smartmove.tpt.ref.ServiceType.priorityTypes#ISTATE]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - adding entity to second-level cache [com.itglovebox.smartmove.tpt.ref.ServiceType#ISTATE]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] cache.NonstrictReadWriteCache - Caching: ISTATE
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - done materializing entity [com.itglovebox.smartmove.tpt.ref.ServiceType#ISTATE]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - resolving associations for [com.itglovebox.smartmove.tpt.ref.ServiceType#LOC]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - loading [com.itglovebox.smartmove.tpt.ref.JobType#GEN]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - attempting to resolve [com.itglovebox.smartmove.tpt.ref.JobType#GEN]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - resolved object in session cache [com.itglovebox.smartmove.tpt.ref.JobType#GEN]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - creating collection wrapper:[com.itglovebox.smartmove.tpt.ref.ServiceType.priorityTypes#LOC]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - adding entity to second-level cache [com.itglovebox.smartmove.tpt.ref.ServiceType#LOC]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] cache.NonstrictReadWriteCache - Caching: LOC
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - done materializing entity [com.itglovebox.smartmove.tpt.ref.ServiceType#LOC]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - resolving associations for [com.itglovebox.smartmove.tpt.ref.ServiceType#METRO]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - loading [com.itglovebox.smartmove.tpt.ref.JobType#PUP]
2004-09-16 11:51:00,545 DEBUG [http-8080-Processor24] impl.SessionImpl - attempting to resolve [com.itglovebox.smartmove.tpt.ref.JobType#PUP]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - resolved object in session cache [com.itglovebox.smartmove.tpt.ref.JobType#PUP]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - creating collection wrapper:[com.itglovebox.smartmove.tpt.ref.ServiceType.priorityTypes#METRO]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - adding entity to second-level cache [com.itglovebox.smartmove.tpt.ref.ServiceType#METRO]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] cache.NonstrictReadWriteCache - Caching: METRO
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - done materializing entity [com.itglovebox.smartmove.tpt.ref.ServiceType#METRO]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - resolving associations for [com.itglovebox.smartmove.tpt.ref.ServiceType#STO]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - loading [com.itglovebox.smartmove.tpt.ref.JobType#GEN]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - attempting to resolve [com.itglovebox.smartmove.tpt.ref.JobType#GEN]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - resolved object in session cache [com.itglovebox.smartmove.tpt.ref.JobType#GEN]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - creating collection wrapper:[com.itglovebox.smartmove.tpt.ref.ServiceType.priorityTypes#STO]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - adding entity to second-level cache [com.itglovebox.smartmove.tpt.ref.ServiceType#STO]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] cache.NonstrictReadWriteCache - Caching: STO
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - done materializing entity [com.itglovebox.smartmove.tpt.ref.ServiceType#STO]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - resolving associations for [com.itglovebox.smartmove.tpt.ref.ServiceType#TAX]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - loading [com.itglovebox.smartmove.tpt.ref.JobType#GEN]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - attempting to resolve [com.itglovebox.smartmove.tpt.ref.JobType#GEN]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - resolved object in session cache [com.itglovebox.smartmove.tpt.ref.JobType#GEN]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - creating collection wrapper:[com.itglovebox.smartmove.tpt.ref.ServiceType.priorityTypes#TAX]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - adding entity to second-level cache [com.itglovebox.smartmove.tpt.ref.ServiceType#TAX]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] cache.NonstrictReadWriteCache - Caching: TAX
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - done materializing entity [com.itglovebox.smartmove.tpt.ref.ServiceType#TAX]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - 5 collections were found in result set
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - collection fully initialized: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#PUP]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - collection fully initialized: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#TT]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - collection fully initialized: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#COUR]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - collection fully initialized: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#GEN]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - collection fully initialized: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#LOGI]
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - 5 collections initialized
2004-09-16 11:51:00,555 DEBUG [http-8080-Processor24] impl.SessionImpl - initializing non-lazy collections
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] support.TransactionSynchronizationManager - Retrieved value [org.springframework.orm.hibernate.SessionHolder@1d1f4fe] for key [net.sf.hibernate.impl.SessionFactoryImpl@95b0a3] bound to thread [http-8080-Processor24]
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] hibernate.HibernateInterceptor - Eagerly flushing Hibernate session
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] impl.SessionImpl - flushing session
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] impl.SessionImpl - Flushing entities and processing referenced collections
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] impl.SessionImpl - Collection found: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#TT], was: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#TT]
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] impl.SessionImpl - Collection found: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#COUR], was: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#COUR]
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] impl.SessionImpl - Collection found: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#LOGI], was: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#LOGI]
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] impl.SessionImpl - Collection found: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#GEN], was: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#GEN]
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] impl.SessionImpl - Collection found: [com.itglovebox.smartmove.tpt.ref.ServiceType.priorityTypes#EXP], was: [com.itglovebox.smartmove.tpt.ref.ServiceType.priorityTypes#EXP]
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] impl.SessionImpl - Collection found: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#PUP], was: [com.itglovebox.smartmove.tpt.ref.JobType.serviceTypes#PUP]
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] impl.SessionImpl - Collection found: [com.itglovebox.smartmove.tpt.ref.ServiceType.priorityTypes#ISTATE], was: [com.itglovebox.smartmove.tpt.ref.ServiceType.priorityTypes#ISTATE]
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] impl.SessionImpl - Collection found: [com.itglovebox.smartmove.tpt.ref.ServiceType.priorityTypes#LOC], was: [com.itglovebox.smartmove.tpt.ref.ServiceType.priorityTypes#LOC]
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] impl.SessionImpl - Collection found: [com.itglovebox.smartmove.tpt.ref.ServiceType.priorityTypes#METRO], was: [com.itglovebox.smartmove.tpt.ref.ServiceType.priorityTypes#METRO]
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] impl.SessionImpl - Collection found: [com.itglovebox.smartmove.tpt.ref.ServiceType.priorityTypes#STO], was: [com.itglovebox.smartmove.tpt.ref.ServiceType.priorityTypes#STO]
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] impl.SessionImpl - Collection found: [com.itglovebox.smartmove.tpt.ref.ServiceType.priorityTypes#TAX], was: [com.itglovebox.smartmove.tpt.ref.ServiceType.priorityTypes#TAX]
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] impl.SessionImpl - Processing unreferenced collections
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] impl.SessionImpl - Scheduling collection removes/(re)creates/updates
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] impl.SessionImpl - Flushed: 0 insertions, 0 updates, 0 deletions to 11 objects
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 11 collections
2004-09-16 11:51:00,565 DEBUG [http-8080-Processor24] impl.Printer - listing entities:
2004-09-16 11:51:00,575 DEBUG [http-8080-Processor24] impl.Printer - com.itglovebox.smartmove.tpt.ref.ServiceType{jobType=JobType#PUP, freightClassReq=N, glAccount=5000, priorityTypes=uninitialized, cubicConversion=250.0, description=INTERSTATE, chargeBy=F, serviceType=ISTATE}
2004-09-16 11:51:00,575 DEBUG [http-8080-Processor24] impl.Printer - com.itglovebox.smartmove.tpt.ref.ServiceType{jobType=JobType#GEN, freightClassReq=N, glAccount=5000, priorityTypes=uninitialized, cubicConversion=250.0, description=EXPRESS, chargeBy=F, serviceType=EXP}
2004-09-16 11:51:00,575 DEBUG [http-8080-Processor24] impl.Printer - com.itglovebox.smartmove.tpt.ref.JobType{jobType=TT, description=TAXI TRUCK, serviceTypes=[]}
2004-09-16 11:51:00,575 DEBUG [http-8080-Processor24] impl.Printer - com.itglovebox.smartmove.tpt.ref.JobType{jobType=LOGI, description=LOGISTICS, serviceTypes=[]}
2004-09-16 11:51:00,575 DEBUG [http-8080-Processor24] impl.Printer - com.itglovebox.smartmove.tpt.ref.ServiceType{jobType=JobType#PUP, freightClassReq=N, glAccount=5000, priorityTypes=uninitialized, cubicConversion=250.0, description=METRO, chargeBy=F, serviceType=METRO}
2004-09-16 11:51:00,575 DEBUG [http-8080-Processor24] impl.Printer - com.itglovebox.smartmove.tpt.ref.JobType{jobType=PUP, description=PICKUPS, serviceTypes=[ServiceType#ISTATE, ServiceType#METRO]}
2004-09-16 11:51:00,575 DEBUG [http-8080-Processor24] impl.Printer - com.itglovebox.smartmove.tpt.ref.ServiceType{jobType=JobType#GEN, freightClassReq=N, glAccount=5000, priorityTypes=uninitialized, cubicConversion=250.0, description=LOCAL, chargeBy=F, serviceType=LOC}
2004-09-16 11:51:00,575 DEBUG [http-8080-Processor24] impl.Printer - com.itglovebox.smartmove.tpt.ref.JobType{jobType=COUR, description=COURIER, serviceTypes=[]}
2004-09-16 11:51:00,575 DEBUG [http-8080-Processor24] impl.Printer - com.itglovebox.smartmove.tpt.ref.JobType{jobType=GEN, description=GENERAL, serviceTypes=[ServiceType#EXP, ServiceType#LOC, ServiceType#STO, ServiceType#TAX]}
2004-09-16 11:51:00,575 DEBUG [http-8080-Processor24] impl.Printer - com.itglovebox.smartmove.tpt.ref.ServiceType{jobType=JobType#GEN, freightClassReq=N, glAccount=5000, priorityTypes=uninitialized, cubicConversion=250.0, description=TAXI TRUCK, chargeBy=F, serviceType=TAX}
2004-09-16 11:51:00,575 DEBUG [http-8080-Processor24] impl.Printer - com.itglovebox.smartmove.tpt.ref.ServiceType{jobType=JobType#GEN, freightClassReq=N, glAccount=5000, priorityTypes=uninitialized, cubicConversion=250.0, description=STORAGE, chargeBy=F, serviceType=STO}
2004-09-16 11:51:00,575 DEBUG [http-8080-Processor24] impl.SessionImpl - executing flush
2004-09-16 11:51:00,575 DEBUG [http-8080-Processor24] impl.SessionImpl - post flush
2004-09-16 11:51:00,575 DEBUG [http-8080-Processor24] support.TransactionSynchronizationManager - Removed value [org.springframework.orm.hibernate.SessionHolder@1d1f4fe] for key [net.sf.hibernate.impl.SessionFactoryImpl@95b0a3] from thread [http-8080-Processor24]
2004-09-16 11:51:00,575 DEBUG [http-8080-Processor24] hibernate.SessionFactoryUtils - Closing Hibernate session
2004-09-16 11:51:00,575 DEBUG [http-8080-Processor24] impl.SessionImpl - closing session
2004-09-16 11:51:00,575 DEBUG [http-8080-Processor24] impl.SessionImpl - disconnecting session
2004-09-16 11:51:00,575 DEBUG [http-8080-Processor24] connection.DriverManagerConnectionProvider - returning connection to pool, pool size: 1
2004-09-16 11:51:00,585 DEBUG [http-8080-Processor24] impl.SessionImpl - transaction completion


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 16, 2004 2:47 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
change
Code:
private static final String fetchJobAndServiceTypesString =
"FROM " + JobType.class.getName() + " AS jt "
+ "LEFT JOIN FETCH jt.serviceTypes";


to
Code:
private static final String fetchJobAndServiceTypesString =
"select jt FROM " + JobType.class.getName() + " AS jt "
+ "LEFT JOIN FETCH jt.serviceTypes";

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 16, 2004 7:47 pm 
Beginner
Beginner

Joined: Sat May 01, 2004 2:44 am
Posts: 32
Location: Brisbane, Australia
anthony wrote:
change
Code:
private static final String fetchJobAndServiceTypesString =
"FROM " + JobType.class.getName() + " AS jt "
+ "LEFT JOIN FETCH jt.serviceTypes";


to
Code:
private static final String fetchJobAndServiceTypesString =
"select jt FROM " + JobType.class.getName() + " AS jt "
+ "LEFT JOIN FETCH jt.serviceTypes";


Hi Anthony,

Thanks for the advice, but unfortunately that does not work either. I still get duplicate JobTypes for > 0 serviceTypes. Actually, they are the same object instance, but just appear more than once in the returned list.

Left join fetching has worked for me in the past using earlier versions of hibernate (1.2, 1.3, etc). I'm wondering if a bug has been introduced in the latest version? Or if it is something in my mapping files going awry.

Scott


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 16, 2004 7:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
This is expected behavior, and is a FAQ.

Hibernate 1.x did not have a FETCH keyword, and behavior of FETCH has never changed in this respect.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 16, 2004 8:36 pm 
Beginner
Beginner

Joined: Sat May 01, 2004 2:44 am
Posts: 32
Location: Brisbane, Australia
gavin wrote:
This is expected behavior, and is a FAQ.

Hibernate 1.x did not have a FETCH keyword, and behavior of FETCH has never changed in this respect.


Yes, my apologies, I meant to say in versions 2.2, 2.3, etc.

It pays to keep up to date with the FAQs, which I haven't read in a while.

Scott


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.