Today I have released Hibernate ORM 5.0 (5.0.0.Final). This has been a long time coming and is the result of the efforts of many folks. Thanks to everyone who helped us get here with fixes, bug reports, suggestions, input and encouragement!
A lot of development has gone into 5.0. Here are the big points:
The venerable way to bootstrap Hibernate (build a SessionFactory) has been to use its Configuration class. Configuration, historically, allowed users to iteratively add settings and mappings in any order and to query the state of settings and mapping information in the middle of that process. Which meant that building the mapping information could not effectively rely on any settings being available. This lead to many limitations and problems.
5.0 introduces a new bootstrapping API aimed at alleviating those limitations and problems, while allowing better determinism and better integration. See the Bootstrap chapter in the User Guide for details on using the new API.
Configuration is still available for use, although in a limited sense. Some of its methods have been removed. Under the covers Configuration makes use of the new bootstrap API.
Hibernate Spatial is a project that has been around for a number of years. Karel Maesen has done an amazing job with it.
Starting in 5.0 Hibernate Spatial is now part of the Hibernate project proper to allow it to better keep up with
upstream development. It is available as
org.hibernate:hibernate-spatial. If your appplication has need for
GIS data, we highly recommend giving hibernate-spatial a try.
Well, ok.. not all of Java 8. Specifically we have added support for Java 8 Date and Time API in regards to easily mapping attributes in your domain model using the Java 8 Date and Time API types to the database. This support is available under the dedicated hibernate-java8 artifact (to isolate Java 8 dependencies). For additional information, see the Basic Types chapter in the Domain Model Mapping Guide.
JPA defines support for GenerationType#AUTO limited to just Number types. Starting in 5.0 Hibernate offers expandable support for a broader
set of types, including built-in support for both Number types (Integer, Long, etc) and UUID. Users are also free to plug
in custom strategies for interpreting GenerationType#AUTO via the new
NamingStrategy has been removed in favor of a better designed API. 2 distinct ones actually:
org.hibernate.boot.model.naming.ImplicitNamingStrategy- used whenever a table or column is not explicitly named to determine the name to use
org.hibernate.boot.model.naming.PhysicalNamingStrategy- used to convert a "logical name" (either implicit or explicit) name of a table or column into a physical name (e.g. following corporate naming guidelines)
5.0 offers significantly improved support for JPA 2.1 AttributeConverters:
fully supported for non-@Enumerated enum values
applicable in conjunction with @Nationalized support
now called to handle null values
settable in hbm.xml by using type="converter:fully.qualified.AttributeConverterName"
integrated with hibernate-envers
collection values, map keys
support for conversion of parameterized types
Support for "bulk id tables" has been completely redesigned to better fit what different databases support.
The transaction SPI underwent a major redesign as part of 5.0 as well. From a user perspective this generally
only comes into view in terms of configuration. Previously applications would work with the different backend
transaction stratagies directly via the
org.hibernate.Transaction API. In 5.0 a level of indirection has been
added here. The API implementation of
org.hibernate.Transaction is always the same now. On the backend, the
org.hibernate.Transaction impl talks to a
org.hibernate.resource.transaction.TransactionCoordinator which represents
the "transactional context" for a given Session according to the backend transaction strategy. Users generally do not
need to care about the distinction.
The change is noted here because it might affect your bootstrap configuration. Whereas previously applications would
hibernate.transaction.factory_class and refer to a
with 5.0 the new contract is
org.hibernate.resource.transaction.TransactionCoordinatorBuilder and is specified using the
hibernate.transaction.coordinator_class setting. See
JavaDocs for additional details.
The following short-names are recognized:
jdbc::(the default) says to use JDBC-based transactions (
jta::says to use JTA-based transactions (
See the User Guide for additional details.
5.0 offers much improvement in the area of schema tooling (export, validation and migration).
Hibernate’s native APIs (Session, etc) have been updated to be typed. No more casting!
Really this started with a frustration over the fragility of hibernate-osgi tests. The first piece was a better testing setup using Pax Exam and Karaf. This lead to us generating (and now publishing!) a Hibernate Karaf features file.
OSGi support has undergone some general improvement as well thanks to feedback from some Karaf and Pax developers and users.
See the Getting Started Guide for additional details on using the new Karaf features file.
A lot of work has gone into the documentation for 5.0. It’s still not complete (is documentation ever "complete"?), but it is much improved.
See the revamped documentation page for details.
For now the plan is to publish the release bundles (zip and tgz) to BinTray. We will continue to publish to SourceForge as well. For the time being we will publish the bundles to both.
Ultimately we will start to publish the "maven" artifacts there as well.
This is all a work in progress.
See http://hibernate.atlassian.net/projects/HHH/versions/20851 for the complete list of changes.
The release tag is available at https://github.com/hibernate/hibernate-orm/releases/tag/5.0.0.Final
See http://hibernate.org/orm/downloads/ for information on obtaining the releases.
Today I released a fourth candidate release for Hibernate ORM 5.0 (5.0.0.CR4). The purpose was entirely to change the defaults for some settings. This allowed some additional fixes and additional documentation work to make it in.
The default ImplicitNamingStrategy (
hibernate.implicit_naming_strategy) has changed to the JPA-compliant one. Additionally
I added some short-names for the Hibernate-provided implementations.
"default" → org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl
"jpa" → org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl
"legacy-jpa" → org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
"legacy-hbm" → org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl
"component-path" → org.hibernate.boot.model.naming.ImplicitNamingStrategyComponentPathImpl
The previous default was "legacy-jpa". Existing applications that previously used the default naming strategy
and want to continue to use that implicit naming strategy should specify
in their configuration settings. Alternatively, they can call
Back in 3.6 I developed a new set of identifier generator strategies aimed at database portability based
on the JPA expectations for
@TableGenerator. Between 3.6 and now the default has been
to continue to use the legacy generator strategies, but we added a setting (
to allow applications to request the newer strategies be used. The default for this setting had been false. The
default is now true.
Existing applications updating to CR4 and then Final that experience issues with identifier generator strategy selection should try setting this back to false if they wish to keep using the legacy mappings.
This is a new feature in 5.0, but previously the default had been to auto-quote any sql identifiers believed to be a keyword in the underlying database. That feature has been disabled by default.
Applications that wish to use this feature should explicitly enable it by specifying
in their configuration settings.
Additionally many other improvements and bugfixes are included. See https://hibernate.atlassian.net/projects/HHH/versions/20752 for the complete list of changes.
The release tag is available at https://github.com/hibernate/hibernate-orm/releases/tag/5.0.0.CR4
Yesterday I released the third candidate release for Hibernate ORM 5.0 (5.0.0.CR3). We felt another CR was warranted because we had some minor integration (SPI) work that we needed to make in to Final, but too much development had happened since the second CR to be considered risk free to just include everything into Final. At any rate CR3 got lots of great TLC :) The complete set of changes can be seen in the Jira changelog. The main changes include:
Essentially passing Session along to the various region access strategy methods to allow integrating with non-JDBC transactions.
Improved namespace (catalog/schema) support overall in schema tools. Improved handling of views and synonyms for migrating and validating.
A few changes were made to the JDCB-based TransactionCoordinator to work more like in JTA environments. Specifically:
implemented support for marking the Transaction for rollback-only.
transaction is now rolled back automatically on a failed commit.
Besides updating the content, the content has been split into 3 separate guides:
Domain Model Mapping Guide
Additionally many other improvements and bugfixes are included. See https://hibernate.atlassian.net/projects/HHH/versions/20150 for the complete list of changes.
The release tag is available at https://github.com/hibernate/hibernate-orm/releases/edit/5.0.0.CR3
The second candidate release for Hibernate ORM 5.0. CR2 was required because of a bug in how class-loading worked in certain managed JPA environments. The details can be found in HHH-9887. The main changes since CR1 include:
This is the blocking issue mentioned above. The problem would occur in environments passing a "temp ClassLoader" into
Hibernate via the JPA integration SPI (
javax.persistence.spi.PersistenceUnitInfo#getNewTempClassLoader) and manifest itself
The second-level caching SPI was improved, allowing the caching providers to generate cache keys. This includes the addition of the following methods:
For those making use of caching immutable entities by reference (rather than by "disassembled" state), an additional performance improvement is included in CR2.
A new feature in 5.0 is the automatic quoting of identifiers that are believed to be keywords in the underlying database.
As this support is new, often the Dialects are too aggressive in what they deem to be keywords.
Thus we added a new setting to disable this behavior if it causes problems in your application.
This can be controlled by specifying
hibernate.auto_quote_keyword as false in configuration settings.
added ability for automatic management of bi-directional associations
self-contained dirty state tracking (more efficient flushing), including switchable algorithms for dirty determination
The Hibernate team is proud to announce the first candidate release for 5.0. The main changes since the Beta2 release include:
- Initial generic typing for Hibernate native (Session, e.g.) APIs
- Continued development of the new bytecode enhancement capabilities including improved support in the Maven and Gradle plugins
- Support for parameterized types with AttributeConverter implementations
- Improved OSGi integration testing using Pax Exam and Karaf, and publishing a hibernate-osgi Karaf features file
- Auto quoting of keywords used as identifiers (
- Incorporating fixes, improvements and suggestions to the improved schema update and validation tooling
A lot of help from the community went into this release and the previous Beta releases. Thanks for all the help and work and testing and doggedness!
As always, see http://hibernate.org/orm/downloads/ for information on obtaining the releases.
Report any issues to Hibernate Jira
I have just finished releasing Hibernate O/RM 5.0.0.Beta2. Beyond Beta1, this release adds:
- Support for Spatial/GIS data through importing Hibernate Spatial.
- Complete redesign of
bulk id tablesused to support update/delete queries against multi-table structures. The redesign helps better fit what different databases support.
- Redesign of transaction management
- Much improved (and still improving!) schema management tooling for export, validation and migration.
At this point, 5.0.0 is getting a lot of testing. So even though it is still in Beta I am feeling pretty confident of its quality. I opted for another Beta here instead of CR1 for a few reasons:
- Investigate whether we want to convert Hibernate's native APIs (Session, etc) to be typed. There is one especially tricky case that needs to be figured out. A major release like this would be the time to do that
- I have just introduced some pretty significant Transaction changes since Beta1. I felt it would be prudent to have one more Beta to allow people time to try out those changes and allow for additional changes based on feedback
- I would still like to complete deprecating the Settings contract. The last piece there is the discussion I started earlier on the dev list wrt its usage in SPI contracts (L2 cache, etc). This effects a few integrations.
- I am working on better Karaf support for hibernate-osgi. Specifically creating a Karaf features respository that users can simply pick up and use. That work is well under way, but ongoing.
As always, see http://hibernate.org/orm/downloads/ for information on obtaining Hibernate O/RM.
We just got done releasing Hibernate O/RM 5.0.0.Beta1. I will follow up later with a more in depth blog post for 5.0.0.Final, but this first Beta implements all new APIs and most new features. Specifically in this Beta include:
- New bootstrapping API - better determinism, better integration
- Java 8 Support (though still compatible with Java 6). Just add hibernate-java8 to your classpath.
- Ability to handle additional Java types for id attributes marked as GenerationType#AUTO. Built-in support for Number and UUID. Expandable via new org.hibernate.boot.model.IdGeneratorStrategyInterpreter extension
- scanning support for non-JPA usage
- NamingStrategy has been removed in favor of a better designed API. 2 actually: org.hibernate.boot.model.naming.ImplicitNamingStrategy and org.hibernate.boot.model.naming.PhysicalNamingStrategy
Additionally, support for AttributeConverters has been expanded and more fully realized:
- fully supported for non-@Enumerated enum values
- applicable in conjunction with @Nationalized support
- called to handle null values
- settable in hbm.xml by using type="converter:fully.qualified.AttributeConverterName"
- integrated with hibernate-envers
- collection values, map keys
See http://hibernate.org/orm/downloads/ for information on obtaining Hibernate ORM.
NOTE: 5.0 is expected to be compatible with Java 6 (aside from the hibernate-java8 module naturally). However, Beta1 will not work with Java 6 due to something with JAXB that I have not yet had time to investigate. Beta1 requires Java 7. Again, the expectation is to have it be compatible with Java 6 by the next release if possible.
I have just released 4.3.1.Final, the first bugfix release for Hibernate ORM 4.3. In addition to bug fixes, a few improvements of note include:
- HHH-5289 : Improved performance of reflection calls
- HHH-6911 : Allows reading and writing @DiscriminatorValue from/to @DiscriminatorColumn when combined with InheritanceType.JOINED (for portability with providers which need DiscriminatorColumn)
- HHH-8865 : Added a new guide on logging to the growing set of topical guides. This is the first know documentation of any sort on using/configuring JBoss Logging, and also discusses some of the more good-to-know specific logging categories. See http://docs.jboss.org/hibernate/orm/4.3/topical/html/logging/Logging.html
See the release page for details of all changes.
Artifacts can be found in the usual places.
The Hibernate team is proud to announce the Hibernate ORM 4.3.0.Final Release. With this release, Hibernate is now a certified implementation of the JPA 2.1 specification. Certified awesomeness!
A lot of work has gone into this release over the last few months. The main focus of 4.3 was JPA 2.1 support, so much of the work these past few months focused on new JPA 2.1 features. The new features defined for JPA 2.1 include:
- Support for stored procedures. See my previous blog for details
- CriteriaUpdate and CriteriaDelete allow definition and execution of UPDATE and DELETE queries in type-safe Criteria form.
- Entity listeners can now take advantage of dependency injection through CDI.
- AttributeConverters, which define the ability to apply conversions on basic values between their database representation and their representation in your domain model. This is similar in concept to Hibernate's Type contract, although certainly less powerful (can only apply to basic values and operate on in-memory values). On the positive side, JPA AttributeConverters are portable across providers.
- Entity Graph support
- Standardized schema generation. With 2.1 JPA now defines schema generation which is standardized across providers in terms of how generation is performed and the settings providers understand as a baseline. Arun Gupta has a good write up of the basic schema generation support.
- Synchronization of persistence contexts via SynchronizationType
- @ConstructorResult support in result set mappings for native queries
The significant non-JPA work that has gone into 4.3 includes:
- Continued improvement in Hibernate's support for OSGi environments. OSGi support in 4.3 is still somewhat bound by certain design limitations within Hibernate, We plan to fully address these limitations in 5.0 (see HHH-8501 for details).
- Continued work on new bytecode enhancement support within Hibernate, adding support for
inline dirty checking. See HHH-8354 for details.
- Initial break down of the monolithic DocBook-based manuals into smaller Asciidoc-based topical guides (HHH-8606). This is an ongoing process.
The full change log for the release can be seen at https://hibernate.atlassian.net/browse/HHH/fixforversion/15150.
In 2 weeks we'll decide whether a CR3 is needed or release Final at that time.
Thanks for all the feedback!