Bit of an update.

After a further bit of researching, we came across NH-3899 
<https://nhibernate.jira.com/browse/NH-3899>. While its not our error 
(Fixed in 4.1, we're currently using 4.1.1.4000), its the commits made to 
fix this error that seem to be causing our error.

There was 1 commit 
<https://github.com/nhibernate/nhibernate-core/commit/013b5da27301adc1fab6a95d9c164d27d1eae03d>
 
made to update the code to its current Hibernate 
<https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/mapping/Column.java>
 
counterpart, but another commit 
<https://github.com/nhibernate/nhibernate-core/commit/16fafd1c086257d5c72946e863a90a3433529c7f>
 
was made almost immediately after to prevent the alias name from becoming 
too long, in particular the changes made to the overloaded method 'GetAlias
(Dialect.Dialect dialect, Table table)' which is being referenced in our 
stacktraces when this error occurs. Furthermore the changes made in this 
commit don't appear to be based off the original Hibernate code (and 
neither does the original code have these changes), so it has us 
questioning whether or not this is correct behaviour.

Relevant lines from the raised error.

System.Exception: Error trying to resolve Service 
'TechCertain.Web.UI.Controllers.HomeController' or one of its autowired 
dependencies (see inner exception for details). ---> System.Exception: Error 
trying to resolve Service 'TechCertain.Domain.Interfaces.IUserRepository' or 
one of its autowired dependencies (see inner exception for details). ---> 
SimpleInjector.ActivationException: The registered delegate for type 
ISessionFactory threw an exception. Unique suffix 10_ length must be less than 
maximum 3 characters. ---> NHibernate.MappingException: Unique suffix 10_ 
length must be less than maximum 3 characters.
  at NHibernate.Mapping.Column.GetAlias (Int32 maxAliasLength) <0x41529310 + 
0x00219> in <filename unknown>:0 
  at NHibernate.Mapping.Column.GetAlias (NHibernate.Dialect.Dialect dialect, 
NHibernate.Mapping.Table table) <0x41529240 + 0x0008d> in <filename unknown>:0 


At this stage we're not sure how to proceed. The Stackoverflow recommended 
solution <https://stackoverflow.com/a/39047655> is to create a custom class 
and override the 'MaxAliasLength' property, but we've tried this without 
success (Nibernate fails to load the class). The only other option we have 
is build NHibernate from source without the second commit capping the alias 
length and ship it in place of the official distribution. If this second 
commit is actually enforcing correct behaviour, then we'll have to figure 
out why the aliases are getting so long.

Any advice and/or additional insight would be welcomed.

On Wednesday, 12 July 2017 21:25:48 UTC+12, Alex Bunn wrote:
>
> Hi all,
>
> We've recently started seeing the following exception 
> (NHibernate.MappingException: Unique suffix 10_ length must be less than 
> maximum 3 characters.) being raised on our website about half a dozen times 
> in quick succession before our website goes down, which is frustrating our 
> customers/clients.
>
> We've had a look over the NHibernate source code on Github, and found that 
> the max alias length allowed by all of the various dialects is 10, which 
> means according to the error, the first part of the generated alias is 7 
> characters in length with the remaining 3 being produced (10_) exceeding 
> the remaining character limit. The limit of 10 being reached in our 
> production environment makes no sense, as we're seeing aliases being 
> generated in our local development machines with a length of 10,11 or 12, 
> all of which should be generating an error.
>
> We're currently using the most recent version of NHibernate available from 
> NuGet (4.1.1.4000 if my IDE isn't lying to me) and currently developing in 
> C#.
>
> We're looking for some additional help/insight on this error so we can 
> figure out what might be causing it, and what we can do to resolve it to 
> make our userbase, and by extension our support/admin team happy.
>
> Thanks.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to nhusers@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to