Well that's my point. There is nothing special, in terms of NH code, that I am doing.
I am doing a simple Session.Load() at this point. Something that is covered, abundantly, in the NH tests. Me writing another simple test (a) would duplicate these tests, (b) wouldn't have failed the same way my own code is, and (c) would have been a waste of time, when my issue is in my configuration. Granted, it took a lot of back and forth with several people to work out where my issue was occurring, but I think my last message about the error .Load() gives me has nailed the issue down for me firmly in the mapping side of thing. That is, Fluent NHibernate, not NHibernate itself. My current research puts my issue in how I'm configuring Fluent NHibernate. Namely, I believe, my issue lies in my PersistenceModel, and where I call AddMappingsFromThisAssembly() instead of AddMappingsFromAssembly(). It appears the former, which I was using, doesn't do what I thought it did, as changing it to use the latter appears to have fixed my issue. That long post there just to point out that I think I've fixed my issue. / Michael / On Jun 2, 4:16 pm, Maximilian Raditya <[email protected]> wrote: > OK, good. That's a starting point as we now can isolate the issue, and it's > not one in NH code base. > > I think the reason of the need of your failing test case would become > clearer. > > -- > Regards, > > Maximilian Haru Raditya > > > > > > > > On Fri, Jun 3, 2011 at 2:52 AM, Beefy <[email protected]> wrote: > > Yes, I have run all the unit tests in both debug and release, and I > > have also changed the projects to compile the test assemblies > > themselves in Release to make sure that didn't make a difference. They > > all pass. I know this much, which is why I'm sure this is something in > > my code that I am missing. > > > I would agree that I would assume this has to do with mappings. > > However, it WORKS in Debug mode. I don't see how switching to Release > > would break my mappings. > > > That said, I am running on a Fluent NHibernate stack (1.2, NH 3.1), so > > FNH is doing the mapping, via manually created mapping classes in one > > of my assemblies. > > > / Michael / > > > On Jun 2, 3:45 pm, Maximilian Raditya <[email protected]> wrote: > > > I'm not sure but it seems it's related to your mapping. How do you map > > your > > > domain objects? Using hbm.xml files? > > > > -- > > > Regards, > > > > Maximilian Haru Raditya > > > > On Fri, Jun 3, 2011 at 2:39 AM, Beefy <[email protected]> wrote: > > > > More fun info: > > > > > When I make the first call a Load, I get this: > > > > > Unable to locate persister: Domain.Model.User > > > > > Perhaps this can help point to an underlying cause, like the > > > > configuration being wrong or something? > > > > > / Michael / > > > > > On Jun 2, 3:24 pm, Beefy <[email protected]> wrote: > > > > > I was told the same thing over in the developer group. As I said > > > > > there, there is nothing special I am doing here. In fact, the test > > > > > case I would write there would be the same one that is already there > > > > > under NHibernate.Tests.Linq.WhereTests.cs > > > > > > This is not an NHibernate bug, it is apparently a bug with my > > > > > implementation, which is why I have moved the discussion here. > > > > > > The only symptom I can provide is the one I have - When my app is > > > > > compiled in Release mode, with NHibernate 3.1 (provided by Fluent > > > > > NHibernate 1.2), NHibernate is not executing any SQL commands except > > > > > for the transaction open and close. > > > > > > / Michael / > > > > > > On Jun 2, 3:04 pm, Maximilian Raditya <[email protected]> wrote: > > > > > > > Michael, > > > > > > > I think a simplified test case (bundled in a solution/project would > > be > > > > > > better) reproducing the issue would be the best shot here. Your > > failing > > > > test > > > > > > case would explain something that is wrong. > > > > > > > I've personally never run into your issue so I'm not sure why it > > > > happened > > > > > > thay way in your case. I'm currently using Linq in NH with NH 3.2 > > Beta > > > > 1 > > > > > > from the trunk and have no issue whether running my own tests in > > Debug > > > > nor > > > > > > Release mode. > > > > > > > -- > > > > > > Regards, > > > > > > > Maximilian Haru Raditya > > > > > > > On Fri, Jun 3, 2011 at 1:18 AM, Beefy <[email protected]> wrote: > > > > > > > I fired up the SQL profiler and looked at what I'm getting there. > > > > > > > > In Release mode, NHibernate is ONLY opening and closing > > transactions, > > > > > > > it is not executing any of the other SQL it needs to. > > > > > > > > So the real question here would be, can anyone think of any > > reason, > > > > > > > configuration, etc. where NHibernate wouldn't execute any of the > > > > > > > commands it should? > > > > > > > > I have some direct SQL statements that DO work (schema check > > stuff I > > > > > > > do) fine, so this appears to be limited to my NHibernate > > > > > > > implementation. > > > > > > > > / Michael / > > > > > > > > On Jun 2, 1:22 pm, Beefy <[email protected]> wrote: > > > > > > > > After bouncing around trying to find what is happening, I'm > > back > > > > with > > > > > > > > a bit more information about my issues... > > > > > > > > > I'm running an MVC app with Fluent NHibernate (NH 3.1). When > > > > compiled > > > > > > > > in Debug mode, everything works splendidly. When compiled in > > > > Release > > > > > > > > mode, NHibernate isn't working. My session is built by > > > > Structuremap, > > > > > > > > which injects a ISessionFactory (Singleton) into an HttpModule > > that > > > > > > > > opens a transaction OnBeginRequest, and commits / rolls back > > > > > > > > OnEndRequest. Nothing really ground breaking here, and as I > > said, > > > > this > > > > > > > > all works in Debug mode. > > > > > > > > > My repository takes in this session, and calls a simple > > > > > > > > > Session.Query<T>().Where(x => x.Email = > > > > > > > > "email").SingleOrDefault(). > > > > > > > > > It does a lot more than that of course, but that is the > > particular > > > > > > > > query I hit FIRST on an executed request (getting a user to > > login). > > > > I > > > > > > > > always get null back from this in Release mode, whereas I get > > the > > > > > > > > right object in Debug mode. > > > > > > > > > THAT IS ALL SETUP FOR THIS. > > > > > > > > > I am running this through NHProfiler to figure out what's > > > > happening. > > > > > > > > In Debug mode, I see the transaction open, all the SQL get > > > > executed, > > > > > > > > and then the transaction closed. In Release mode, I see the > > > > > > > > transaction open, and then it just closes without executing any > > > > SQL. > > > > > > > > There is something I am doing that is causing NHibernate to not > > > > > > > > execute any SQL when in Release mode, OR NHibernate only > > outputs > > > > the > > > > > > > > information NH Profiler needs when in Debug mode (Though it > > DOES > > > > > > > > output the transaction begin/end log...). Just in case, I > > turned on > > > > my > > > > > > > > own log4net log and go this out of it: > > > > > > > > > DEBUG 2011-06-02 12:03:36,349 [16] SessionImpl - > > > > [session- > > > > > > > > id=449a1286-ff0e-46af-a4cc-235877c723b7] opened session at > > > > timestamp: > > > > > > > > 634426130163, for session factory: > > > > [/a28575cbfee44a269368768a28d01c78] > > > > > > > > DEBUG 2011-06-02 12:03:36,363 [16] AdoTransaction - > > Begin > > > > > > > > (Unspecified) > > > > > > > > DEBUG 2011-06-02 12:03:36,366 [16] iverConnectionProvider - > > > > Obtaining > > > > > > > > IDbConnection from Driver > > > > > > > > DEBUG 2011-06-02 12:03:36,373 [16] QueryPlanCache - > > located > > > > > > > > HQL query plan in cache (.SingleOrDefault[Domain.Model.User] > > > > > > > > (.Where[Domain.Model.User] > > > > > > > > (NHibernate.Linq.NhQueryable`1[STEP.Domain.Model.User], > > Quote((x, ) > > > > => > > > > > > > > (String.op_Equality(x.Email, p1))), ), )) > > > > > > > > DEBUG 2011-06-02 12:03:36,376 [16] QueryPlanCache - > > located > > > > > > > > HQL query plan in cache (.SingleOrDefault[Domain.Model.User] > > > > > > > > (.Where[Domain.Model.User] > > > > > > > > (NHibernate.Linq.NhQueryable`1[STEP.Domain.Model.User], > > Quote((x, ) > > > > => > > > > > > > > (String.op_Equality(x.Email, p1))), ), )) > > > > > > > > DEBUG 2011-06-02 12:03:36,378 [16] HQLQueryPlan - > > > > > > > > find: .SingleOrDefault[STEP.Domain.Model.User] > > > > > > > > (.Where[Domain.Model.User] > > > > > > > > (NHibernate.Linq.NhQueryable`1[STEP.Domain.Model.User], > > Quote((x, ) > > > > => > > > > > > > > (String.op_Equality(x.Email, p1))), ), ) > > > > > > > > DEBUG 2011-06-02 12:03:36,379 [16] QueryParameters - > > named > > > > > > > > parameters: {} > > > > > > > > DEBUG 2011-06-02 12:03:36,382 [16] ControllerBase - > > Action: > > > > > > > > Account.LogOn | Time(s): 0.011 > > > > > > > > DEBUG 2011-06-02 12:03:36,384 [16] ControllerBase - > > > > > > > > ActionResult: Account.LogOn => RedirectToRouteResult | Time(s): > > 0 > > > > > > > > DEBUG 2011-06-02 12:03:36,385 [16] AdoTransaction - > > Start > > > > > > > > Commit > > > > > > > > DEBUG 2011-06-02 12:03:36,386 [16] SessionImpl - > > before > > > > > > > > transaction completion > > > > > > > > DEBUG 2011-06-02 12:03:36,388 [16] AdoTransaction - > > > > > > > > IDbTransaction Committed > > > > > > > > DEBUG 2011-06-02 12:03:36,389 [16] SessionImpl - > > > > > > > > transaction completion > > > > > > > > DEBUG 2011-06-02 12:03:36,390 [16] ConnectionManager - > > > > > > > > aggressively releasing database connection > > > > > > > > DEBUG 2011-06-02 12:03:36,391 [16] ConnectionProvider - > > Closing > > > > > > > > connection > > > > > > > > DEBUG 2011-06-02 12:03:36,392 [16] AdoTransaction - > > > > > > > > IDbTransaction disposed. > > > > > > > > DEBUG 2011-06-02 12:03:36,393 [16] SessionImpl - > > > > [session- > > > > > > > > id=449a1286-ff0e-46af-a4cc-235877c723b7] running > > ISession.Dispose() > > > > > > > > DEBUG 2011-06-02 12:03:36,394 [16] SessionImpl - > > > > [session- > > > > > > > > id=449a1286-ff0e-46af-a4cc-235877c723b7] executing real > > > > Dispose(True) > > > > > > > > DEBUG 2011-06-02 12:03:36,395 [16] SessionImpl - > > closing > > > > > > > > session > > > > > > > > DEBUG 2011-06-02 12:03:36,398 [16] AbstractBatcher - > > running > > > > > > > > BatcherImpl.Dispose(true) > > > > > > > > > Again, it would seem that Nhibernate is either not spitting out > > any > > > > > > > > logging info when in Release mode, or is simply not executing > > any > > > > of > > > > > > > > it's queries. When my solution is compiled in debug mode I get > > > > > > > > thousands more lines of log messages, so I assume NHibernate is > > not > > > > > > > > outputting a lot of stuff when the calling solution is compiled > > in > > > > > > > > Release mode... > > > > > > > > > Does anyone have any insights into what I may be doing wrong? > > > > > > > > Connection String properties that only work in Debug mode for > > some > > > > > > > > reason? > > > > > > > > > Or even better, a way to make NHibernate spit out the same info > > for > > > > > > > > the Release mode vs Debug mode so I can compare what they are > > > > doing? > > > > > > > > -- > > > > > > > You received this > > ... > > read more » -- 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.
