-->
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: 'fetch' functionality been changed in 0.9x ?
PostPosted: Thu Sep 08, 2005 7:49 am 
Senior
Senior

Joined: Thu Aug 25, 2005 3:35 am
Posts: 160
In 0.84 I was able to use this query:
Code:
session.Find("from eg.Person as person left join fetch person.Children " );


where person.Children is a bag, lazy loaded.

I upgraded to 0.9 and on the exact same query I now receive a mapping error: 'no persistor for person.Children.

Am I missing something?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 08, 2005 10:04 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Can you give more details about your mapping ?

It looks like the 0.8.4 version allows something that the v0.9 don't (probably because of a bug fix)

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 08, 2005 10:10 am 
Senior
Senior

Joined: Thu Aug 25, 2005 3:35 am
Posts: 160
update: this seems to be a first chance exception. I can continue it, and it will return the objects...

it seems actually that i get all kinds of exceptions:
Additional information: No persister for: (
Additional information: No persister for: =
Additional information: No persister for: 170
Additional information: No persister for: )

all from this:
A first chance exception of type 'NHibernate.MappingException' occurred in nhibernate.dll

so it seems there might be a bigger issue, not that related to the fetch


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 08, 2005 10:32 am 
Senior
Senior

Joined: Thu Aug 25, 2005 3:35 am
Posts: 160
mapping is for a one to many property. I've changed domainmodel naming for simplicity and a simpler Parent/child relation:


Code:
<class name="eg.Person, eg" table="person" mutable="false">

... id and other stuff left out for brevity

<bag name="children" inverse="true" lazy="true" cascade="all">
<key column="SubjectNr" />
<one-to-many class="eg.Child, eg" />
</bag>

</class>



Code:
<class name="eg.Child, eg" table="childs" mutable="false" >

<composite-id name="Identity" class="eg.childKey, eg" unsaved-value="none">
<key-many-to-one name="Parent" class="eg.Person, eg" column="SUBJECTNR" />

<key-property name="category" column="SOORT" />

.. other keys left out

</composite-id>
</class>



What I want is this (worked in 0.840):
session.Find("from eg.Person as person inner join fetch person.children as child where child.Identity.category= 170 " );

Explanation: I want to retrieve all parents and eagerly fetch the children, but only the children of category 170. (actually, that is a subtype so I would want to use something like child.class = xxx. That property is missing in nhibernate).


That gives the kind of errors in the previous post.
It does work though! ( i can click through the first-chance exceptions and it will produce the result I'm looking for).


I even get exceptions on the simplest of simplest query:
session.Find("from eg.Person as person inner join fetch person.Children" );

As you can see in the call stack below, it is trying to get to the class persoon.Inkomens (in my example: person.Children) and it's not resolving to the mapped class........

One of the exception call stacks:
Code:
   nhibernate.dll!NHibernate.Impl.SessionFactoryImpl.GetPersister(string className = "persoon.Inkomens") + 0x6b bytes   
   nhibernate.dll!NHibernate.Hql.QueryTranslator.GetPersisterUsingImports(string className = "persoon.Inkomens") + 0x54 bytes   
   nhibernate.dll!NHibernate.Hql.FromParser.Token(string token = "persoon.Inkomens", NHibernate.Hql.QueryTranslator q = {NHibernate.Hql.QueryTranslator}) + 0x7f5 bytes   
   nhibernate.dll!NHibernate.Hql.ClauseParser.Token(string token = "persoon.Inkomens", NHibernate.Hql.QueryTranslator q = {NHibernate.Hql.QueryTranslator}) + 0x3e4 bytes   
   nhibernate.dll!NHibernate.Hql.PreprocessingParser.End(NHibernate.Hql.QueryTranslator q = {NHibernate.Hql.QueryTranslator}) + 0x27 bytes   
   nhibernate.dll!NHibernate.Hql.ParserHelper.Parse(NHibernate.Hql.IParser p = {NHibernate.Hql.PreprocessingParser}, string text = "from DomainModel.Persoon.Persoon as persoon inner join fetch persoon.Inkomens", string seperators = " \n\r\f\t,()=<>&|+-=/*'^![]#~\\", NHibernate.Hql.QueryTranslator q = {NHibernate.Hql.QueryTranslator}) + 0x126 bytes   
   nhibernate.dll!NHibernate.Hql.QueryTranslator.Compile() + 0x77 bytes   
   nhibernate.dll!NHibernate.Hql.QueryTranslator.Compile(NHibernate.Engine.ISessionFactoryImplementor factory = {NHibernate.Impl.SessionFactoryImpl}, System.Collections.IDictionary replacements = {Count=0}, bool scalar = false) + 0x4d bytes   
   nhibernate.dll!NHibernate.Impl.SessionFactoryImpl.GetQuery(string queryString = "from DomainModel.Persoon.Persoon as persoon inner join fetch persoon.Inkomens", bool shallow = false) + 0xe9 bytes   
   nhibernate.dll!NHibernate.Impl.SessionImpl.GetQueries(string query = "from DomainModel.Persoon.Persoon as persoon inner join fetch persoon.Inkomens", bool scalar = false) + 0x3a bytes   
   nhibernate.dll!NHibernate.Impl.SessionImpl.Find(string query = "from DomainModel.Persoon.Persoon as persoon inner join fetch persoon.Inkomens", NHibernate.Engine.QueryParameters parameters = {NHibernate.Engine.QueryParameters}) + 0xc3 bytes   
   nhibernate.dll!NHibernate.Impl.SessionImpl.Find(string query = "from DomainModel.Persoon.Persoon as persoon inner join fetch persoon.Inkomens", System.Object[] values = {Length=0}, NHibernate.Type.IType[] types = {Length=0}) + 0x36 bytes   
   nhibernate.dll!NHibernate.Impl.SessionImpl.Find(string query = "from DomainModel.Persoon.Persoon as persoon inner join fetch persoon.Inkomens") + 0x27 bytes   
>   batch.dll!Batch.VerwerkenBestandHeffingskorting.Start() Line 28 + 0x16 bytes   C#



Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 08, 2005 4:10 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Yes, I think I changed that part to correspond closer to the Java source, and Java source has GetPersister throw an exception, instead of just returning null. I'll change it back now.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 09, 2005 2:30 am 
Senior
Senior

Joined: Thu Aug 25, 2005 3:35 am
Posts: 160
cool, thanks. :D


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.