-->
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.  [ 1 post ] 
Author Message
 Post subject: Can NHibernate exit your app without throwing an exception?
PostPosted: Mon Mar 30, 2009 3:19 am 
Beginner
Beginner

Joined: Mon Jan 05, 2009 7:08 am
Posts: 24
hello, Can NHibernate exit your app without throwing an exception?

I'm debugging a console app and
Code:
void main(...)
{
try {
IPerson oParent = LoadPerson(123);

} catch(Exception ex)
{
   Console.WriteLine(ex.ToString()); // this was never hit!?
}
return;
}

public IPerson LoadPerson(long nId)
...
try {

// DAO call which uses NHibernate ISession.Get(nId). Then "Children" are retrieved by another mechanism, but initial ISession.Get and subsequent loading of children are two separate member functions wrapped under single transaction scope (i.e. not NHibernate... long story short, it uses a self-referencing table to hold parent-child relationship. This table uses a different mapping file. Retrieved oChild.Parent is set to oParent which I think is... the primarily culprit)

using (oScope = new TransactionScope(TransactionScopeOption.Required))
{
   IPerson oParent = Session.Get(nId);

   LoadChildren(oParent);

  foreach(IPerson oChild in oParent.Children)
  {
     oChild.Parent = oParent; // If I comment out this line my app won't "exit silently" (not immediately, but after exit from "LoadPerson")!! Question is why!?

    oChild.Parent = new Person(); // Event this would save the app from silently exiting (after exit from "LoadPerson")

  }
}

} catch (Exception ex)
{
   Console.WriteLine(ex.ToString()); // this was never hit?!
}

returns oParent;
}


Any suggestion as to posssibility of NHibernate causing my WIN32 console app to exit silently? I have catch(Exception) on all levels but still I didn't manage to catch any exception and therefore don't know what killed it... I initially suspected loading children is a recursive ops but if infinitely recursion was the cause of death I should have a StackOverflowException do I? But I have nothing. I understand you can't "catch" a StackOverflowException" but still if you run app on debugger, debugger will be able to tell you that under all circumstances right? I think OutofMemory is another example... (I tested this on another simple toy app)

I dunno, pretty clueless, not sure if it's somewhere recursive voodo gone wrong or .... all i know is if i don't do this app is fine (but you'd lose parent<-Child directional link.
Code:
oChild.Parent = oParent;



Many thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.