Hi I have include a property "Id" in my entities and it works better !
I noticed that when using the StateFullField Attributes of Burrow (or when nhibernate generated a id for a idbag), the problem reappears. :/ I will submit a JIRA ticket because i think the multi database support is a important feature... Again thank you for your advices ! JbM On 28 jan, 20:40, Oscar Orduz Acosta <[email protected]> wrote: > Hi Marchal: > By the exception you gave, I presume you are using WebUtil and that module > currently I am not using it. > > However doing a quick review in the burrow source I found the following code > in "EntityLoader.GetId" (Wich is called in your stack trace): > > public object GetId(object o) > { > if (o == null) > { > return null; > } > PropertyInfo pi = null; > try { > pi = o.GetType().GetProperty("Id"); > } > catch ( AmbiguousMatchException e) { > > } > if (pi != null) > { > return pi.GetValue(o, null); > } > else > { > return GetSession(o.GetType()).GetIdentifier(o); > } > } > > So, I'm totally agree with you, apparently the code to find out the > identifier first try to find a property called "Id", if this is not found > take the current ISession to take that information. Unfortunately it uses > the statement: "GetSession(o.GetType())" to retrieve the ISession, so it may > be other Session than you are using... > > My advice: You can: > > A - Submit a JIRA ticket with that issue and wait for corrections > B - Include in your entities a property "Id" (It is just a guess I don't > know if it can works) > C - Try to fix yourself the code ( I suggested modify the > statement GetSession(o.GetType()) to other similar to your DAO does) > > I expected this can help! > > Oscar > > 2009/1/28 Marchal Jb <[email protected]> > > > > > The trunk don't resolve this problem in Burrow with Multiple databases. > > > In my GenericDAO, there is a method to bring a good ISession : > > > protected ISession Session > > { > > get > > { > > string PersitenceUnitToUse = (string)new > > AppSettingsReader().GetValue("persistenceUnit", typeof(String)); > > > if (string.IsNullOrEmpty(PersitenceUnitToUse)) > > return new BurrowFramework().GetSession(_NHTypeEntite); > > else > > return new > > BurrowFramework().GetSession(PersitenceUnitToUse); > > } > > } > > > But i think some times NH automaticaly put a ISession (when data changed > > for example) and without called my ISession Session method. And i can see > > that NH give the first PersitentUnit ;( > > > In this case where can i precise my ISession logic ? > > > for details : The exception i have when NH use the wrong PersistentUnit > > (...) > > in SessionImpl.cs in the method : > > public object GetIdentifier(object obj) > > > if (obj is INHibernateProxy) { (..) } > > else > > { > > EntityEntry entry = persistenceContext.GetEntry(obj); *//HERE IS > > THE PROBLEM : not the good persistenceContext ?! > > * if (entry == null) //entry is not find :( > > { > > throw new TransientObjectException("the instance was not > > associated with this session"); > > } > > return entry.Id; > > } > > and the stack trace : > > > [TransientObjectException: the instance was not associated with this > > session] > > NHibernate.Impl.SessionImpl.GetIdentifier(Object obj) in > > C:\DICSIT\nouveau\sources\NHibernate\Impl\SessionImpl.cs:1268 > > NHibernate.Burrow.Util.EntityLoader.GetId(Object o) in > > C:\DICSIT\nouveau\sources\NHibernate.Burrow\Util\EntityLoader.cs:62 > > NHibernate.Burrow.WebUtil.Impl.EntityVSFInterceptorBase.OnSave(Object > > toSave, Object objectInStateContainer) in > > C:\DICSIT\nouveau\sources\NHibernate.Burrow.WebUtil\Impl\EntityVSFInterceptor.cs:16 > > NHibernate.Burrow.WebUtil.Impl.StatefulFieldSaver.ProcessFields() in > > C:\DICSIT\nouveau\sources\NHibernate.Burrow.WebUtil\Impl\StatefulFieldSaver.cs:23 > > NHibernate.Burrow.WebUtil.Impl.StatefulFieldProcessor.Process() in > > C:\DICSIT\nouveau\sources\NHibernate.Burrow.WebUtil\Impl\StatefulFieldProcessor.cs:40 > > > NHibernate.Burrow.WebUtil.Impl.StatefulFieldPageModule.page_PreRenderComplete(Object > > sender, EventArgs e) in > > C:\DICSIT\nouveau\sources\NHibernate.Burrow.WebUtil\Impl\StatefulFieldPageModule.cs:66 > > System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +2063008 > > System.Web.UI.Page.ProcessRequestMain(Boolean > > includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2247 > > Thanks for your help ! > > > JbM- Masquer le texte des messages précédents - > > - Afficher le texte des messages précédents - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
