-->
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.  [ 6 posts ] 
Author Message
 Post subject: HQL troubles
PostPosted: Fri May 27, 2005 11:46 am 
Regular
Regular

Joined: Tue May 24, 2005 12:55 pm
Posts: 56
I'm having some odd results from a query that returns 3 items. Items 2 & 3 are returned correctly but item 1 which is an NH object is not populated.

I'm trying to do the follwing HQL query:
SELECT crp, crp.Rep.FirstName, crp.Rep.LastName FROM ClientRepPanel AS crp WHERE crp.ClientId = 4 AND crp.RepId = 52

I have tried the follwoing as well with no luck:
SELECT crp, rep.FirstName, rep.LastName FROM ClientRepPanel AS crp INNER JOIN crp.Rep as rep WHERE crp.ClientId = 4 AND crp.RepId = 52

Here is the code using the query:
Code:
IList results = _mgr.SimpleFind("SELECT crp, crp.Rep.FirstName, crp.Rep.LastName FROM ClientRepPanel AS crp WHERE crp.ClientId = 4 AND crp.RepId = 52");
foreach(object[] result in results)
{
   ClientRepPanel crp = (ClientRepPanel) result[0];
   Console.WriteLine("result[0]: {0}", result[0].ToString());
   Console.WriteLine("CL id: {0}\tREP id: {1}\tFeeSplit: {2}", crp.ClientId, crp.RepId, crp.FeeSplitPct);
   Console.WriteLine("\tName: {0} {1}", result[1].ToString(), result[2].ToString());
}

[OUTPUT]
results.Count: 1
result[0]: SourceNet.Data.ClientRepPanel
CL id: 0   REP id: 0   FeeSplit: -9999.0
   Name: John Barnett


The following works:
Code:
IList results = _mgr.SimpleFind("SELECT crp FROM ClientRepPanel AS crp WHERE crp.ClientId = 4 AND crp.RepId = 52");
foreach(ClientRepPanel crp in results)
{
   Console.WriteLine("CL id: {0}\tREP id: {1}\tFeeSplit: {2}", crp.ClientId, crp.RepId, crp.FeeSplitPct);
}

[OUTPUT]
CL id: 4   REP id: 52   FeeSplit: 84.0


Here is my mapping files:
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="SourceNet.Data.ClientRepPanel, SourceNet.Data" table="CL_REP_XREF" lazy="true">
<jcs-cache usage="read-write" />
   <composite-id>
      <key-property column="CL_ID" name="ClientId" type="Int32"  access="field.camelcase-underscore"/>
      <key-property column="REP_ID" name="RepId" type="Int32"  access="field.camelcase-underscore"/>
   </composite-id>
   <property column="SERVICE_AREA" name="ServiceArea" access="field.camelcase-underscore" type="String" length="1028" not-null="false"/>
   <property column="FEE_SPLIT_PCT" name="FeeSplitPct" access="field.camelcase-underscore" type="Nullables.NHibernate.NullableDecimalType, Nullables.NHibernate" not-null="false"/>
   <property column="SPECIAL_ORDERS" name="SpecialOrders" access="field.camelcase-underscore" type="Boolean" not-null="true"/>
   <many-to-one column="REP_CL_PANEL_STATUS_ID" name="RepClientPanelStatus" class="SourceNet.Data.RepClientPanelStatus, SourceNet.Data" cascade="all" access="field.camelcase-underscore" insert="false" update="false" outer-join="true"/>
   <many-to-one column="REP_ID" name="Rep" class="SourceNet.Data.Rep, SourceNet.Data" cascade="all" access="field.camelcase-underscore" insert="false" update="false" outer-join="true"/>
   <many-to-one column="CL_ID" name="Client" class="SourceNet.Data.Client, SourceNet.Data" cascade="all" access="field.camelcase-underscore" insert="false" update="false" outer-join="true"/>
</class>
</hibernate-mapping>

<hibernate-mapping namespace="SourceNet.Data" xmlns="urn:nhibernate-mapping-2.0">
<class name="SourceNet.Data.Rep, SourceNet.Data" table="REP" dynamic-update="true" dynamic-insert="true" lazy="true" proxy="SourceNet.Data.Rep, SourceNet.Data">
<jcs-cache usage="read-write" />
   <id column="REP_ID" name="Id" unsaved-value="0" access="field.camelcase-underscore" type="Int32">
      <generator class="native" />
   </id>
   <property column="REP_TYPE_ID" name="TypeId" access="field.camelcase-underscore" type="Int32" not-null="false" />
   <!-- Many, many unrelated properties/-->
   <many-to-one column="PARENT_REP_ID" name="ParentRep" class="SourceNet.Data.Rep, SourceNet.Data" cascade="all" />
</class>
</hibernate-mapping>


To make this post even longer here is the log. It looks like the SELECT on the clientreppanel happens twice:
Quote:
2005-05-27 09:42:17,786 [4276] DEBUG NHibernate.Impl.SessionFactoryImpl [] <> - Instantiated session factory
2005-05-27 09:42:17,817 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - opened session
2005-05-27 09:42:17,817 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - find: SELECT crp, crp.Rep.FirstName, crp.Rep.LastName FROM ClientRepPanel AS crp WHERE crp.ClientId = 4 AND crp.RepId = 52
2005-05-27 09:42:17,817 [4276] DEBUG NHibernate.Engine.QueryParameters [] <> - No Types and Values
2005-05-27 09:42:17,817 [4276] DEBUG NHibernate.Hql.QueryTranslator [] <> - compiling query
2005-05-27 09:42:17,864 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - flushing session
2005-05-27 09:42:17,864 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - Flushing entities and processing referenced collections
2005-05-27 09:42:17,864 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - Processing unreferenced collections
2005-05-27 09:42:17,864 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - Processed 0 unreachable collections.
2005-05-27 09:42:17,864 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - scheduling collection removes/(re)creates/updates
2005-05-27 09:42:17,864 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - Processed 0 for recreate (0), remove (0), and update (0)
2005-05-27 09:42:17,864 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - Flushed: 0 insertions, 0 updates, 0 deletions to 0 objects
2005-05-27 09:42:17,864 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
2005-05-27 09:42:17,864 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - dont need to execute flush
2005-05-27 09:42:17,864 [4276] DEBUG NHibernate.Hql.QueryTranslator [] <> - HQL: SELECT crp, crp.Rep.FirstName, crp.Rep.LastName FROM SourceNet.Data.ClientRepPanel AS crp WHERE crp.ClientId = 4 AND crp.RepId = 52
2005-05-27 09:42:17,864 [4276] DEBUG NHibernate.Hql.QueryTranslator [] <> - SQL: select clientre0_.CL_ID as CL_ID, clientre0_.REP_ID as REP_ID, clientre0_.FEE_SPLIT_PCT as FEE_SPLI4_, clientre0_.REP_CL_PANEL_STATUS_ID as REP_CL_P6_, clientre0_.SPECIAL_ORDERS as SPECIAL_5_, clientre0_.SERVICE_AREA as SERVICE_3_, clientre0_.CL_ID as x0_0_, clientre0_.REP_ID as x0_1_, rep1_.FIRST_NAME as x1_0_, rep1_.LAST_NAME as x2_0_ from CL_REP_XREF clientre0_, REP rep1_ where clientre0_.REP_ID=rep1_.REP_ID and ((clientre0_.CL_ID=4)AND(clientre0_.REP_ID=52))
2005-05-27 09:42:17,864 [4276] DEBUG NHibernate.Hql.QueryTranslator [] <> - HQL: SELECT crp, crp.Rep.FirstName, crp.Rep.LastName FROM SourceNet.Data.ClientRepPanel AS crp WHERE crp.ClientId = 4 AND crp.RepId = 52
2005-05-27 09:42:17,864 [4276] DEBUG NHibernate.Hql.QueryTranslator [] <> - SQL: select clientre0_.CL_ID as CL_ID, clientre0_.REP_ID as REP_ID, clientre0_.FEE_SPLIT_PCT as FEE_SPLI4_, clientre0_.REP_CL_PANEL_STATUS_ID as REP_CL_P6_, clientre0_.SPECIAL_ORDERS as SPECIAL_5_, clientre0_.SERVICE_AREA as SERVICE_3_, clientre0_.CL_ID as x0_0_, clientre0_.REP_ID as x0_1_, rep1_.FIRST_NAME as x1_0_, rep1_.LAST_NAME as x2_0_ from CL_REP_XREF clientre0_, REP rep1_ where clientre0_.REP_ID=rep1_.REP_ID and ((clientre0_.CL_ID=4)AND(clientre0_.REP_ID=52))
2005-05-27 09:42:17,880 [4276] INFO NHibernate.Loader.Loader [] <> - select clientre0_.CL_ID as CL_ID, clientre0_.REP_ID as REP_ID, clientre0_.FEE_SPLIT_PCT as FEE_SPLI4_, clientre0_.REP_CL_PANEL_STATUS_ID as REP_CL_P6_, clientre0_.SPECIAL_ORDERS as SPECIAL_5_, clientre0_.SERVICE_AREA as SERVICE_3_, clientre0_.CL_ID as x0_0_, clientre0_.REP_ID as x0_1_, rep1_.FIRST_NAME as x1_0_, rep1_.LAST_NAME as x2_0_ from CL_REP_XREF clientre0_, REP rep1_ where clientre0_.REP_ID=rep1_.REP_ID and ((clientre0_.CL_ID=4)AND(clientre0_.REP_ID=52))
2005-05-27 09:42:17,880 [4276] DEBUG NHibernate.Connection.DriverConnectionProvider [] <> - Obtaining IDbConnection from Driver
2005-05-27 09:42:17,911 [4276] DEBUG NHibernate.Loader.Loader [] <> - processing result set
2005-05-27 09:42:17,942 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning '4' as column: CL_ID
2005-05-27 09:42:17,942 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning '52' as column: REP_ID
2005-05-27 09:42:17,942 [4276] DEBUG NHibernate.Loader.Loader [] <> - result row: SourceNet.Data.ClientRepPanel
2005-05-27 09:42:17,942 [4276] DEBUG NHibernate.Loader.Loader [] <> - Initializing object from DataReader: SourceNet.Data.ClientRepPanel
2005-05-27 09:42:17,942 [4276] DEBUG NHibernate.Loader.Loader [] <> - Hydrating entity: SourceNet.Data.ClientRepPanel#SourceNet.Data.ClientRepPanel
2005-05-27 09:42:17,942 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning '52' as column: REP_ID
2005-05-27 09:42:17,942 [4276] DEBUG Nullables.NHibernate.NullableTypesType [] <> - returning '84.00' as column: FEE_SPLI4_
2005-05-27 09:42:17,942 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning '2' as column: REP_CL_P6_
2005-05-27 09:42:17,942 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning '4' as column: CL_ID
2005-05-27 09:42:17,942 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning 'True' as column: SPECIAL_5_
2005-05-27 09:42:17,942 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning null as column: SERVICE_3_
2005-05-27 09:42:17,942 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning '4' as column: x0_0_
2005-05-27 09:42:17,942 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning '52' as column: x0_1_
2005-05-27 09:42:17,973 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - loading [ClientRepPanel#SourceNet.Data.ClientRepPanel]
2005-05-27 09:42:18,020 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning 'John' as column: x1_0_
2005-05-27 09:42:18,020 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning 'Barnett' as column: x2_0_
2005-05-27 09:42:18,020 [4276] DEBUG NHibernate.Loader.Loader [] <> - done processing result set (1 rows)
2005-05-27 09:42:18,020 [4276] DEBUG NHibernate.Loader.Loader [] <> - total objects hydrated: 1
2005-05-27 09:42:18,020 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - resolving associations for: [SourceNet.Data.ClientRepPanel#SourceNet.Data.ClientRepPanel]
2005-05-27 09:42:18,020 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - loading [Rep#52]
2005-05-27 09:42:18,270 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - loading [RepClientPanelStatus#2]
2005-05-27 09:42:18,270 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - attempting to resolve [RepClientPanelStatus#2]
2005-05-27 09:42:18,270 [4276] DEBUG NHibernate.Cache.ReadWriteCache [] <> - Cache lookup: 2
2005-05-27 09:42:18,270 [4276] DEBUG NHibernate.Cache.ReadWriteCache [] <> - Cache miss: 2
2005-05-27 09:42:18,270 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - object not resolved in any cache [SourceNet.Data.RepClientPanelStatus#2]
2005-05-27 09:42:18,270 [4276] DEBUG NHibernate.Persister.EntityPersister [] <> - Materializing entity: SourceNet.Data.RepClientPanelStatus#2
2005-05-27 09:42:18,286 [4276] DEBUG NHibernate.Type.NullableType [] <> - binding '2' to parameter: 0
2005-05-27 09:42:18,286 [4276] INFO NHibernate.Loader.Loader [] <> - SELECT repclien0_.REP_CL_PANEL_STATUS_ID as REP_CL_P1_0_, repclien0_.REP_CL_PANEL_STATUS_TITLE as REP_CL_P3_0_, repclien0_.REP_CL_PANEL_STATUS_DESC as REP_CL_P4_0_, repclien0_.REP_CL_PANEL_STATUS_CD as REP_CL_P2_0_ FROM REP_CL_PANEL_STATUS repclien0_ WHERE repclien0_.REP_CL_PANEL_STATUS_ID = @p0
2005-05-27 09:42:18,286 [4276] DEBUG NHibernate.Loader.Loader [] <> - processing result set
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Loader.Loader [] <> - result row: 2
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Loader.Loader [] <> - Initializing object from DataReader: 2
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Loader.Loader [] <> - Hydrating entity: SourceNet.Data.RepClientPanelStatus#2
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning 'Active' as column: REP_CL_P3_0_
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning 'active reps for this client panel' as column: REP_CL_P4_0_
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning 'ACTIVE' as column: REP_CL_P2_0_
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Loader.Loader [] <> - done processing result set (1 rows)
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Loader.Loader [] <> - total objects hydrated: 1
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - resolving associations for: [SourceNet.Data.RepClientPanelStatus#2]
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - adding entity to JCS cache [SourceNet.Data.RepClientPanelStatus#2]
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Cache.ReadWriteCache [] <> - Caching: 2
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Cache.ReadWriteCache [] <> - Cached: 2
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - done materializing entity [SourceNet.Data.RepClientPanelStatus#2]
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - loading [Client#4]
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - adding entity to JCS cache [SourceNet.Data.ClientRepPanel#SourceNet.Data.ClientRepPanel]
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Cache.ReadWriteCache [] <> - Caching: SourceNet.Data.ClientRepPanel
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Cache.ReadWriteCache [] <> - Cached: SourceNet.Data.ClientRepPanel
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - done materializing entity [SourceNet.Data.ClientRepPanel#SourceNet.Data.ClientRepPanel]
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - initializing non-lazy collections
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - attempting to resolve [ClientRepPanel#SourceNet.Data.ClientRepPanel]
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Cache.ReadWriteCache [] <> - Cache lookup: SourceNet.Data.ClientRepPanel
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Cache.ReadWriteCache [] <> - Cache miss: SourceNet.Data.ClientRepPanel
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - object not resolved in any cache [SourceNet.Data.ClientRepPanel#SourceNet.Data.ClientRepPanel]
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Persister.EntityPersister [] <> - Materializing entity: SourceNet.Data.ClientRepPanel#SourceNet.Data.ClientRepPanel
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Type.NullableType [] <> - binding '4' to parameter: 0
2005-05-27 09:42:18,302 [4276] DEBUG NHibernate.Type.NullableType [] <> - binding '52' to parameter: 1
2005-05-27 09:42:18,302 [4276] INFO NHibernate.Loader.Loader [] <> - SELECT clientre0_.CL_ID as CL_ID1_, clientre0_.REP_ID as REP_ID1_, clientre0_.FEE_SPLIT_PCT as FEE_SPLI4_1_, clientre0_.REP_CL_PANEL_STATUS_ID as REP_CL_P6_1_, clientre0_.SPECIAL_ORDERS as SPECIAL_5_1_, clientre0_.SERVICE_AREA as SERVICE_3_1_, repclien1_.REP_CL_PANEL_STATUS_ID as REP_CL_P1_0_, repclien1_.REP_CL_PANEL_STATUS_TITLE as REP_CL_P3_0_, repclien1_.REP_CL_PANEL_STATUS_DESC as REP_CL_P4_0_, repclien1_.REP_CL_PANEL_STATUS_CD as REP_CL_P2_0_ FROM CL_REP_XREF clientre0_ left outer join REP_CL_PANEL_STATUS repclien1_ on clientre0_.REP_CL_PANEL_STATUS_ID=repclien1_.REP_CL_PANEL_STATUS_ID WHERE clientre0_.CL_ID = @p0 AND clientre0_.REP_ID = @p1
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Loader.Loader [] <> - processing result set
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning '2' as column: REP_CL_P1_0_
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Loader.Loader [] <> - result row: 2, SourceNet.Data.ClientRepPanel
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Loader.Loader [] <> - Initializing object from DataReader: SourceNet.Data.ClientRepPanel
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Loader.Loader [] <> - Hydrating entity: SourceNet.Data.ClientRepPanel#SourceNet.Data.ClientRepPanel
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning '52' as column: REP_ID1_
2005-05-27 09:42:18,317 [4276] DEBUG Nullables.NHibernate.NullableTypesType [] <> - returning '84.00' as column: FEE_SPLI4_1_
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning '2' as column: REP_CL_P6_1_
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning '4' as column: CL_ID1_
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning 'True' as column: SPECIAL_5_1_
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Type.NullableType [] <> - returning null as column: SERVICE_3_1_
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Loader.Loader [] <> - done processing result set (1 rows)
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Loader.Loader [] <> - total objects hydrated: 1
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - resolving associations for: [SourceNet.Data.ClientRepPanel#SourceNet.Data.ClientRepPanel]
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - loading [Rep#52]
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - loading [RepClientPanelStatus#2]
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - attempting to resolve [RepClientPanelStatus#2]
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - resolved object in session cache [SourceNet.Data.RepClientPanelStatus#2]
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - loading [Client#4]
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - adding entity to JCS cache [SourceNet.Data.ClientRepPanel#SourceNet.Data.ClientRepPanel]
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Cache.ReadWriteCache [] <> - Caching: SourceNet.Data.ClientRepPanel
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Cache.ReadWriteCache [] <> - Cached: SourceNet.Data.ClientRepPanel
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - done materializing entity [SourceNet.Data.ClientRepPanel#SourceNet.Data.ClientRepPanel]
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - initializing non-lazy collections
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - closing session
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - disconnecting session
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Connection.ConnectionProvider [] <> - Closing connection
2005-05-27 09:42:18,317 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - transaction completion
2005-05-27 09:42:18,333 [4276] DEBUG NHibernate.Impl.SessionImpl [] <> - running ISession.Dispose()


Last edited by tinomen on Tue May 31, 2005 3:31 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon May 30, 2005 10:53 am 
Expert
Expert

Joined: Fri May 13, 2005 5:56 pm
Posts: 308
Location: Santa Barbara, California, USA
i think you might have a problem in your mapping / object model. you have:

ClientRepPanel m-1 with Rep
Rep m-1 with ClientRepPanel

that can't be right can it? it would have to be a m-m relationship wouldn't it?

in my experience, m-1 has to have a 1-m on the other side, mapped with inverse="true" for proper collection management. what does your data model look like?

-devon


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 31, 2005 12:31 pm 
Regular
Regular

Joined: Tue May 24, 2005 12:55 pm
Posts: 56
Quote:
i think you might have a problem in your mapping / object model. you have:

ClientRepPanel m-1 with Rep
Rep m-1 with ClientRepPanel

that can't be right can it? it would have to be a m-m relationship wouldn't it?


Sorry, i don't see where I have a relationship mapped to the ClientRepPanel in Rep. I've deliberately left out the relation in Rep. However, there is a many-to-one mapped to a parent rep.


Top
 Profile  
 
 Post subject: Hibernate Docs
PostPosted: Tue May 31, 2005 3:29 pm 
Regular
Regular

Joined: Tue May 24, 2005 12:55 pm
Posts: 56
I'm basing this query from the following example found in the Hibernate docs.

Quote:
Queries may return multiple objects and/or properties as an array of type Object[]

select mother, offspr, mate.name
from eg.DomesticCat as mother
inner join mother.mate as mate
left outer join mother.kittens as offspr


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 31, 2005 5:11 pm 
Expert
Expert

Joined: Fri May 13, 2005 5:56 pm
Posts: 308
Location: Santa Barbara, California, USA
damn! you're right about the ClientRepPanel mapping. not sure why I though I saw that in the mapping files...


Top
 Profile  
 
 Post subject: Fixed
PostPosted: Wed Jun 01, 2005 7:05 pm 
Regular
Regular

Joined: Tue May 24, 2005 12:55 pm
Posts: 56
Turns out that because the objects are being cached the ClientRepPanel (w/ the compsite-id) data was lost because I didn't have the ISerializable interface implemented along with overriding the Equals/GetHash methods.:x Doing this fixed the problem.

The lack of good documentation (even on the Hibernate site) and examples isn't helping me to sell this to my CTO. :(


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