NHibernate 5.0 released

479 views
Skip to first unread message

Alexander Zaytsev

unread,
Oct 10, 2017, 6:31:53 AM10/10/17
to nhibernate-development, nhusers

NHibernate 5.0.0 is now released with 141 issues resolved.

For a list of resolved issues, see the release notes:
https://github.com/nhibernate/nhibernate-core/blob/5.0.0/releasenotes.txt

Binaries are available on NuGet and SourceForge:
https://sourceforge.net/projects/nhibernate/files/NHibernate/5.0.0/
https://www.nuget.org/packages/NHibernate/5.0.0

Highlights
  • IO bound methods have gained an async counterpart. Not intended for parallelism, make sure to await each
    call before further interacting with a session and its queries.
  • Strongly typed DML operation (insert/update/delete) are now available as Linq extensions on queryables.
  • Entities collections can be queried with .AsQueryable() Linq extension without being fully loaded.
  • Reference documentation has been curated and completed, notably with a Linq section.
    http://nhibernate.info/doc/nhibernate-reference/index.html
Known BREAKING CHANGES from NH4.1.1.GA to 5.0.0

NHibernate now targets .Net 4.6.1.

Remotion.Linq and Antlr3 libraries are no more merged in the NHibernate library,
and must be deployed along NHibernate library. (NuGet will reference them.)

Classes and members which were flagged as obsolete in the NHibernate 4.x series have been dropped.
Prior to upgrading, fix any obsolete warning according to its message. See NH-4075 and NH-3684 for a list.

Possible Breaking Changes
  • All members exposing some System.Data types have been changed for the corresponding System.Data.Common
    types. (IDbCommand => DbCommand, ...)
  • The Date NHibernate type will no more replace by null values below its base value (which was year 1753).
    Its base value is now DateTime.MinValue. Its configuration parameter is obsolete.
  • NHibernate type DateTimeType, which is the default for a .Net DateTime, does no longer cut fractional
    seconds. Use DateTimeNoMsType if you wish to have fractional seconds cut. It applies to its Local/Utc
    counterparts too.
  • LocalDateTimeType and UtcDateTimeType do no more accept being set with a value having a non-matching kind,
    they throw instead.
  • DbTimestamp will now round the retrieved value according to Dialect.TimestampResolutionInTicks.
  • When an object typed property is mapped to a NHibernate timestamp, setting an invalid object in the
    property will now throw at flush instead of replacing it with DateTime.Now.
  • Decimal type registration now correctly handles maximal precision. For most dialects, it is 28, matching
    the .Net limit. Values in mappings above maximal precision will be reduced to maximal precision.
  • Default cast types do no more resolve string to 255 length and decimal to its default precision/scale for
    the dialect. They resolve to 4000 length string and (28, 10) precision/scale decimals by default, and are
    trimmed down according to dialect. Those defaults can be overridden with query.default_cast_length,
    query.default_cast_precision and query.default_cast_scale settings.
  • Transaction scopes handling has undergone a major rework. See NH-4011 for full details.
    • More transaction promotion to distributed may occur if you use the "flush on commit" feature with
      transaction scopes. Explicitly flush your session instead. Ensure it does not occur by disabling
      transaction.use_connection_on_system_events setting.
    • After transaction events no more allow using the connection when they are raised from a scope
      completion.
    • Connection enlistment in an ambient transaction is now enforced by NHibernate by default.
    • The connection releasing is no more directly triggered by a scope completion, but by later
      interactions with the session.
  • AdoNetWithDistributedTransactionFactory has been renamed AdoNetWithSystemTransactionFactory.
  • Subcriteria.UniqueResult for value types now return default(T) when result is null, as was
    already doing CriteriaImpl.UniqueResult.
  • AliasToBeanResultTransformer property/field resolution logic has changed for supporting members
    which names differ only by case. See NH-3693 last comments for details.
  • Linq extension methods marked with attribute LinqExtensionMethod will no more be evaluated
    in-memory prior to query execution when they do not depend on query results, but will always be
    translated to their corresponding SQL call. This can be changed with a parameter of the attribute.
  • Linq Query methods are now native members of ISession and IStatelessSession instead of being
    extension methods.
  • Linq provider now use Remotion.Linq v2, which may break Linq provider extensions, mainly due to names
    changes. See #568 changes to test files for examples.
  • NHibernate Linq internals have undergone some minor changes which may break custom Linq providers due
    to method signature changes and additional methods to implement.
  • IMapping interface has an additional Dialect member. ISessionFactoryImplementor has lost it, since it
    gains it back through IMapping.
  • IDriver.ExpandQueryParameters and DriverBase.CloneParameter take an additional argument.
  • NullableType, its descendent (notably all PrimitiveType) and IUserType value getters and setters now
    take the session as an argument. This should mainly impact custom types implementors.
  • EmitUtil is now internal and has been cleaned of unused members.
  • ContraintOrderedTableKeyColumnClosure has been renamed ConstraintOrderedTableKeyColumnClosure.
  • enabledFilter parameter has been removed from IProjection.ToSqlString and ICriterion.ToSqlString methods.
  • Proxy factory and proxy cache now use TypeInfo instead of System.Type. This should be transparent for
    most users.
  • Exceptions which were based on ApplicationException are now based on Exception: HibernateException,
    ParserException and AssertionFailure. The logger factory which could throw a bare ApplicationException
    now throws an InstantiationException instead.
  • ThreadSafeDictionary class has been removed. Use System.Collections.Concurrent.ConcurrentDictionary
    instead.
  • Entity mode switching capability, which had never been fully implemented, is dropped.
  • BytecodeProviderImpl, intended for .Net Framework 1 and broken, is dropped.
  • Sessions concrete classes constructors have been changed. (It is not expected for them to be used
    directly.)
  • Obsolete setting interceptors.beforetransactioncompletion_ignore_exceptions is dropped.
  • SQL Server 2008+ dialects now use datetime2 instead of datetime for all date-time types, including
    timestamp. This can be reverted with sql_types.keep_datetime setting.
  • SQL Server 2008+ timestamp resolution is now 100ns in accordance with datetime2 capabilities, down from
    10ms previously. This can be reverted with sql_types.keep_datetime setting.
  • Oracle 9g+ dialects now use timestamp(7) for all date time types, instead of timestamp(4).
  • Oracle 9g+ timestamp resolution is now 100ns in accordance with timestamp(7) capabilities, down from
    100µs previously.
  • Oracle: Hbm2dll will no-more choose N- prefixed types for typing Unicode string columns by default.
    This can be changed with oracle.use_n_prefixed_types_for_unicode setting, which will furthermore
    control DbCommand parameters typing accordingly. See NH-4062.
  • SqlServerCe: the id generator "native" will now resolve as table-hilo instead of identity.
  • Firebird: timestamp resolution is now 1ms.
  • PostgreSQL: if Npgsql v3 or later is used, time DbParameters will be fetched as TimeSpan instead of
    DateTime.
  • DB2 & Oracle lite: decimal type registration was hardcoding precision as 19 and was using length as
    scale. It now uses precision and scale from mapping when specified, and disregards length.
  • Ingres & Sybase ASA: decimal type registration was hardcoding precision as 18 and was using length as
    scale. It now uses precision and scale from mapping when specified, and disregards length.
  • ODBC: String parameter length will no more be specified by the OdbcDriver.

--

Huge thanks to everyone involved in this release, especially to Frédéric Delaporte, Oskar Berggren, Boštjan Markežič (maca88), and Nathan Brown for their invaluable help.

Special thanks to Boštjan for awesome AsyncGenerator without which this release would not be possible.

Best Regards,
Alexander 

Ricardo Peres

unread,
Oct 10, 2017, 6:59:20 PM10/10/17
to nhusers
Excellent work, guys! Well done!

RP

Gunnar Liljas

unread,
Oct 10, 2017, 7:13:55 PM10/10/17
to nhu...@googlegroups.com
Excellent indeed! I've complained that nothing much happened, but the last few months has been super inspiring to see. Great work, guys!

I promise I'll add to the effort soon. At least I did this: https://github.com/MassTransit/MassTransit/pull/1008  :)

/G

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to nhu...@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.

For more options, visit https://groups.google.com/d/optout.

Ricardo Peres

unread,
Oct 11, 2017, 1:01:39 PM10/11/17
to nhusers
Hey Alex,

The page at http://nhibernate.info/doc/nhibernate-reference/index.html still mentions version 4.1.

RP

On Tuesday, October 10, 2017 at 11:31:53 AM UTC+1, Alexander Zaytsev wrote:

Alexander Zaytsev

unread,
Oct 11, 2017, 4:34:17 PM10/11/17
to nhusers
Yeah, we're working on this.

One step at a time.

Best Regards,
Alexander

--

Gunnar Liljas

unread,
Oct 11, 2017, 7:14:46 PM10/11/17
to nhu...@googlegroups.com
Any particular areas we could/should assist with?

Felipe Oriani

unread,
Oct 13, 2017, 8:18:01 AM10/13/17
to nhu...@googlegroups.com
Great job guys. Congrats to all envolved.

I was thinking the version 5.0 of NHibernate would offer support for .Net Core. Is there any blocks to provide this support?

Thank you.




______________________________________
Felipe B Oriani

frederic...@free.fr

unread,
Oct 17, 2017, 9:40:16 AM10/17/17
to nhusers
ngbrown is doing a great work on that subject. The main PR is https://github.com/nhibernate/nhibernate-core/pull/633
There are some related prerequisite PR too.
One of the troublesome subject is the lack of database schema handling API in .Net Core, feature on which the NHibernate test suit heavily rely.
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 https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

--
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 https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

--
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 https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

frederic...@free.fr

unread,
Oct 17, 2017, 9:40:27 AM10/17/17
to nhusers
The 5.0 documentation is now published, along with previous versions.
http://nhibernate.info/doc/index.html

Rico Pfennig

unread,
Oct 18, 2017, 11:02:23 AM10/18/17
to nhusers
Thanks for release! I already tried the new version but I figured a different behavior then versions before (maybe it is a bug). What is the best way to provide this issue? Here or in Stackoverflow? In the Jira issue tracker it seems I don't have the right to create an issue for the main project.

Alexander Zaytsev

unread,
Oct 18, 2017, 3:23:42 PM10/18/17
to nhusers
Thanks Rico

We just finished a migration from JIRA to GitHub to make it easier for users to submit issues.

So, now the best way to submit issues is via GitHub: https//github.com/nhibernate/nhibernate-core/issues

Best Regards,
Alexander


On Thu, 19 Oct 2017 at 4:02 AM, 'Rico Pfennig' via nhusers <nhu...@googlegroups.com> wrote:
Thanks for release! I already tried the new version but I figured a different behavior then versions before (maybe it is a bug). What is the best way to provide this issue? Here or in Stackoverflow? In the Jira issue tracker it seems I don't have the right to create an issue for the main project.

--

stevedp...@gmail.com

unread,
Nov 6, 2017, 10:21:02 AM11/6/17
to nhusers
Does anyone know if this version will work with Fluent Nhibernate?

Michael Powell

unread,
Nov 6, 2017, 10:27:45 PM11/6/17
to nhusers


On Monday, November 6, 2017 at 10:21:02 AM UTC-5, stevedp...@gmail.com wrote:
Does anyone know if this version will work with Fluent Nhibernate?


The dependencies wouldn't prohibit the version itself.

However, with all the changes, some of them pretty significant if I followed the changes correctly, I doubt it?

That said, could be wrong, and I haven't tried myself.

Try it? Spin up a small spike project and give it a try?

Ricardo Peres

unread,
Nov 7, 2017, 5:36:28 AM11/7/17
to nhusers
Nothing against FNH, but the current version of NH offers similar features (although, that's true, FNH's syntax is prettier, IMO), and, especially, with conventions, there is much less need for explicit mapping (also IMO).
Just my 5 cents! ;-)

RP

Michael Powell

unread,
Nov 7, 2017, 7:09:07 AM11/7/17
to nhu...@googlegroups.com
Prettier syntax. Yes, of course. And definitely also conventions.
That's kind of the point: "fluent".

> RP
>
> --
> 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/T1LRHM6HMtw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to

Ricardo Peres

unread,
Nov 7, 2017, 7:39:56 AM11/7/17
to nhusers
Does FNH have conventions?

RP

Ricardo Peres

unread,
Nov 7, 2017, 7:40:40 AM11/7/17
to nhusers
BTW, the source code for FNH hasn't been updated in two years: https://github.com/jagregory/fluent-nhibernate.

RP

On Tuesday, November 7, 2017 at 12:39:56 PM UTC, Ricardo Peres wrote:
Does FNH have conventions?

RP

Felipe Oriani

unread,
Nov 7, 2017, 12:17:19 PM11/7/17
to nhu...@googlegroups.com
Fluent NHibernate has conventions

I agree with Ricardo, the sintaxe of FNH is nice and it would be nice if it could be part of NHibernate in the next major versions :D




--
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+unsubscribe@googlegroups.com.

To post to this group, send email to nhu...@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Michael Powell

unread,
Nov 7, 2017, 12:19:31 PM11/7/17
to nhu...@googlegroups.com
On Tue, Nov 7, 2017 at 12:16 PM, Felipe Oriani <felipe...@gmail.com> wrote:
> Fluent NHibernate has conventions.
>
> I agree with Ricardo, the sintaxe of FNH is nice and it would be nice if it
> could be part of NHibernate in the next major versions :D

I'm not sure I agree "part of" NH releases.

NH is a dependency for FNH.

But, yes, perhaps you meant, at least track with NH updates,
particularly major ones like this?

You are on the wrong list for that, I'm afraid.

> On Tue, Nov 7, 2017 at 10:40 AM, Ricardo Peres <rjp...@gmail.com> wrote:
>>
>> BTW, the source code for FNH hasn't been updated in two years:
>> https://github.com/jagregory/fluent-nhibernate.
>>
>> RP
>>
>>
>> On Tuesday, November 7, 2017 at 12:39:56 PM UTC, Ricardo Peres wrote:
>>>
>>> Does FNH have conventions?
>>>
>>> RP
>>
>> --
>> 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 https://groups.google.com/group/nhusers.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
> ______________________________________
> Felipe B Oriani
> felipe...@gmail.com
>
> --
> 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/T1LRHM6HMtw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> nhusers+u...@googlegroups.com.

Gunnar Liljas

unread,
Nov 7, 2017, 2:19:57 PM11/7/17
to nhu...@googlegroups.com
I too prefer FNH, and I think it should work just fine with NH5. If not, I'll see if I can assist. FNH is probably more widely used than NH's own coded mapping, so it's in our interest to see its support.

/G

2017-11-07 18:19 GMT+01:00 Michael Powell <mwpow...@gmail.com>:
On Tue, Nov 7, 2017 at 12:16 PM, Felipe Oriani <felipe...@gmail.com> wrote:
> Fluent NHibernate has conventions.
>
> I agree with Ricardo, the sintaxe of FNH is nice and it would be nice if it
> could be part of NHibernate in the next major versions :D

I'm not sure I agree "part of" NH releases.

NH is a dependency for FNH.

But, yes, perhaps you meant, at least track with NH updates,
particularly major ones like this?

You are on the wrong list for that, I'm afraid.

> On Tue, Nov 7, 2017 at 10:40 AM, Ricardo Peres <rjp...@gmail.com> wrote:
>>
>> BTW, the source code for FNH hasn't been updated in two years:
>> https://github.com/jagregory/fluent-nhibernate.
>>
>> RP
>>
>>
>> On Tuesday, November 7, 2017 at 12:39:56 PM UTC, Ricardo Peres wrote:
>>>
>>> Does FNH have conventions?
>>>
>>> RP
>>
>> --
>> 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

>> To post to this group, send email to nhu...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/nhusers.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
> ______________________________________
> Felipe B Oriani
> felipe...@gmail.com
>
> --
> 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/T1LRHM6HMtw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to

> To post to this group, send email to nhu...@googlegroups.com.
> Visit this group at https://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.

Gunnar Liljas

unread,
Nov 7, 2017, 7:06:07 PM11/7/17
to nhu...@googlegroups.com
I just performed a test upgrade of our largest, MASSIVE NHibernate project, and while there certainly were some issues (which should be expected), there were no issues with FNH.

/G

Ricardo Peres

unread,
Nov 8, 2017, 5:23:20 AM11/8/17
to nhusers
What I feel, don't know if you guys agree, is the lack of a project like unhaddins, something outside of the core NHibernate project where we could add useful extensions, conventions, etc.
I started something along these lines myself and I was going to publish it to NuGet, but haven't found the time.

RP

Alexander Zaytsev

unread,
Nov 8, 2017, 5:32:09 AM11/8/17
to nhu...@googlegroups.com
Hi Ricardo,

I feel like that projects like “contrib”, “addins”, “extensions” and other “combined” projects don’t work well. It’s much better to make smaller projects with clear boundaries.

Best Regards,
Alexander
--
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.

Ricardo Peres

unread,
Nov 8, 2017, 5:36:18 AM11/8/17
to nhusers
Hi, Alex!
Anything you say, but let's get it started! :-)
Some good candidates IMO could be:

- A friendlier wrapper for the loquacious configuration
- Extended conventions for common scenarios (many-to-many, for example)

RP
Reply all
Reply to author
Forward
0 new messages