|
I'm getting an intermittant problem with NHibernate where it generates a query for an entity, but replaces one of the columns with a column from completely different (and unrelated) entity. It only ever replaces a single column, and is generally solved by restarting the application (though sometimes it takes a couple of attempts).
Any input on this would be much appreciated! Entity
Entity Mapping
Report Entity
Report Entity Mapping
SQL Query, Generated By NHibernate
Exception
As you can see, nhibernate has replaced the LiquiditySourceItem column 'Traderevalcurr' with 'InitialAmountUSD', which belongs to the BusinessBreakdownStandardPosition entity. These entities have no relationship whatsoever. Otherwise, the SQL is exactly as you'd expect( including column order). Observations
Any thoughts? http://stackoverflow.com/questions/21382756/nhibernate-wrong-columns-on-queries http://stackoverflow.com/questions/16991838/nhibernate-generating-wrong-columns-on-queries |
Does this fail on both DEV and PROD servers?
One thought, not sure if it will help BUT if it fails on DEV you may be able to…
· Generate the XML files on build session factory.
· Look to see if all is OK with the XML files…. Check and double check
· Comment out your configuration for the mapping-by-code `AddDeserializedMapping`
· Embed the XML as resource
· Use the XML mappings when building sessionfactory and test again
This at least (*might*) rule in/out if it is a mapping-by-code issue…
Rippo
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
nhusers+u...@googlegroups.com.
To post to this group, send email to nhu...@googlegroups.com.
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/groups/opt_out.
Property(x => x.USDCharge);' to 'Property(x => x.USDCharge, map => map.Column("USDCharge"));' “This suggests to me that NHibernate isn't actually using these generated files to perform the db/entity mapping, rather it's doing it programmatically”
The XML or (mapping-by-code that is injected) is used by the session factory upon creation…
Can you post the code the builds the sessionfactory?
Also what does this 'Property(x => x.USDCharge);’ translate to in XML terms? That is when you write out XML what is shown for this property?
I must admit I have used NH for many years and have never seen this behaviour, but it does seem odd to be sure…. I am sure if this was a bug then it would have been picked up before. Do you share multiple entities with same mapping file or vice versa?
In my case (note I never use map.Column unless the column names are not the same):-
Property(x => x.NewsDate, x => x.NotNullable(true));
Translates to
<property name="NewsDate" not-null="true" />
And this
Property(x => x.NewsDate);
Translates to
<property name="NewsDate" />
Both these XML representations are fine, I prefer the first one as I tend not to use nulls.
--
...
Hello Tom,
...
<c
Keep up the good work Shawn! The asp.net environment is definitely more susceptible to race conditions than a simple console app.
/Oskar
For more options, visit https://groups.google.com/d/optout.
return hashCode == other.GetHashCode();
return hashCode == other.GetHashCode() && ToString() == other.ToString();
Nice work! I don't have access to the code at the moment, but it must be decided if PropertyPath should have reference equality or by-value equality. Based on your excerpt, the current code seems to use reference equality (but in a broken way), while your proposed change makes it neither (since it compares both the value and the reference based hashcode, it's a mix of semantics).
Please have a search in JIRA to see if you find something that looks similar.
/Oskar
--
You received this message because you are subscribed to a topic in the Google Groups "nhusers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nhusers/BZoBoyWQEvs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nhusers+u...@googlegroups.com.
...