Member Menu
 
 Monthly JBoss newsletter:
 
Hibernate Books
CaveatEmptor

Road Map

Note that this page is mainly intended as a macro view of features we would like to implement moving forward; it is a blog of sorts. For detailed roadmap information, please see the Hibernate or NHibernate issue tracking systems.


Hibernate 2.1

Hibernate2 is a stable and complete object/relational mapping solution with all functionality needed by a typical Java application. Hibernate 2.x is no longer being actively developed.

We recommend and encourage Hibernate users to consider migrating to Hibernate3.


Hibernate 3.0

Hibernate3 makes it easier than ever before for Java applications to interact with persistent data, allowing a single definition of the transformation between various in-memory representations of the entity data and the relational schema, even in the case of very complex legacy schemas and schemas for historical data or data with visibility rules. Hibernate3 also provides the most comprehensive object/relational query functionality, with three full-featured query facilities: Hibernate Query Language, the newly enhanced Hibernate Criteria Query API, and enhanced support for queries expressed in the native SQL dialect of the database.

Hibernate 3.0 has been released in Q1 2005 and is considered stable for development and production. See the migration guide for update information if you are using Hibernate 2.x.

Major new features in Hibernate 3.0 include:

Virtualization

A number of important and interesting problems may be solved by presenting the user with a certain, filtered, subset of the data. For example, a user might want to see data valid at a particular point in time, or may have permissions to view data only in a particular region. Rather than forcing application code to specify this filter criteria in tedious query conditions, Hibernate3 will allow the (parameterized) filters to be applied at the session level.

For example, the following code:

session.enableFilter("region").setParameter("regionCode", "AU");
List regionEmployees = session.createQuery("from Employee").list();

would return just the employees in the AU region, assuming that the Employee class specified a region filter as follows:

<class name="Employee">
    ...
    <filter name="region" condition="REG = :regionCode"/>
</class>

But the actual filter is defined globally, and shared by many class and collection mappings:

<filter-def name="region">
    <filter-param name="regionCode" type="string"/>
</class>

More Mapping Flexibility

For the overwhelming majority of cases, Hibernate2 provides all the O/R mapping options you will need. However, there are now a few new features that are powerful, if used judiciously. They are certainly not to be considered essential, but they round out the structural mapping functionality. This includes:

  • single class to multiple table mappings (the <join> mapping element)
  • efficient table-per-concrete-class mappings with support for polymorphism (the <union-subclass> mapping element)
  • "mixed" table-per-hierarchy / table-per-subclass inheritance mapping strategy, and table-per-subclass inheritance with a discriminator column
  • powerful "content-based" discrimination for table-per-hierarchy mappings (formula-based discriminators)
  • ability to map association tables as having one-to-many multiplicity at the object level
  • support for unidirectional one-to-many associations mapped to a not-null foreign key
  • support for association joins based on SQL formulas and for SQL formulas defined at the <column> level
  • support update and insert and formula attributes for properties of components
  • immutable entities may now be mapped to SQL (from-clause) subselects, instead of tables (useful if you would like to have a database view, but don't)
  • collection keys may now specify a property-ref, allowing mapping of associations that do not reference primary keys
  • property-ref associations may now be efficiently fetched using outer joins
  • property-ref may now refer to a combination of properties (enclosed in the new <properties> element)
  • optimistic lock checking may now be disabled for individual properties

Representation Independence

Hibernate was conceived as a persistence solution for POJO domain models, and that remains the focus. Occasionally, we run into people who would like to represent their persistent entities in some more dynamic way - as a map, essentially. Hibernate3 lets you represent your domain model as trees of maps, or, with a little bit of user-written code, as just about anything.

  • <dynamic-class> mappings, to allow a persistent HashMap
  • support for "named" entities, so different instances of the same class may be persisted to several tables
  • user-extension framework in the property and proxy package

In particular, Hibernate now supports the mapping of dom4j XML trees directly to the relational database.

  • query XML directly using HQL or the Criteria query API
  • make XML data persistent via the Session API
  • replicate data between systems using XML as an intermediate format, together with the replicate() operation

Statistics reporting and JMX-based monitoring

Hibernate3 reports various statistics using the new Statistics object, and also exposes this functionality via JMX. This feature helps discover performance problems in production applications.

A second-level cache and query cache browser is also provided.

JDK 1.5 Enhancements

The new JDK has been released as a preview earlier this year and we expect a slow migration to the new 1.5 platform throughout 2004. While Hibernate3 still runs perfectly with JDK 1.2, Hibernate3 will make use of some new JDK features. JSR 175 annotations, for example, are a perfect fit for Hibernate metadata and we will embrace them aggressively. We will also support Java generics, which basically boils down to allowing typesafe collections.

Support for Stored Procedures and hand-written SQL

Hibernate3 allows arbitrary SQL statements to be specified in the mapping document for create, update, and delete operations. This means you will also be able to map entities to custom Stored Procedures.

Furthermore, any named SQL or HQL query may be specified as the query to use for loading an entity by primary key.

Finally, the native SQL query facility has been enhanced, including support for returning simple scalar values and loading collections.

This means it is possible to override any SQL generated by Hibernate with handwritten SQL.

Full Event Driven Design

Hibernate3 features an event-oriented design, with event objects representing any "interesting thing" that occurs in the persistence layer and listener classes that implement standard Hibernate behaviors, or customized user-defined behaviors. This user extension capability has applications ranging from auditing to implementing "strange" cascade semantics.

JACC/JAAS based security model

Hibernate3 allows CRUD operations for entities to be permissioned in a J2EE environment.

AST-based HQL parser

HQL is being reimplemented from the ground up, using an ANTLR grammar and AST-based approach. This should allow much better exception reporting for invalid HQL, and allow us to fix a couple of minor limitations of the language, especially the lack of an ON clause.

EJB3-style persistence operations

EJB3 defines the create() and merge() operations, which are slightly different to Hibernate's saveOrUpdate() and saveOrUpdateCopy() operations. Hibernate3 will support all four operations as methods of the Session interface.

Subselect fetching

As an alternative to batch fetching, subselect fetching allows efficient fetching of collections.

Efficient cascade delete

Hibernate3 allows the use ON DELETE CASCADE foreign key definitions when this is supported by the underlying database.

Column-level lazy fetching

This is a checkbox feature that Hibernate needs for marketing purposes. Any property may be marked lazy="true", and will be fetched from the database when the field is first accessed. This feature requires build-time bytecode instrumentation using an Ant task. If Hibernate encounters uninstrumented classes at runtime, the feature will be transparently disabled.

Ease of use

We have made Hibernate easier for new users, by simplifying two areas which often cause problems:

  • association fetch strategy configuration
  • use of detached objects with natural (assigned or composite) keys

Default values are now much more sensible and it is now not usually necessary to specify the lazy or unsaved-value attributes, or implement Interceptor.isUnsaved().

Revamped criteria query API

The Criteria API has been heavily upgraded in Hibernate3. In particular:

  • it is now possible to specify projected properties and aggregates, including grouping
  • subqueries are supported
  • criteria queries may now be defined outside the context of a Session
  • the Criterion framework was heavily refactored, and is now much easier to extend

Better support for CMT

Hibernate3 may be configured to automatically flush and close the session in a CMT environment, eliminating noisy exception and transaction handling code.

Support for database-generated GUIDs

The new guid identifier generator supports database-generated GUIDs on Microsoft SQL Server and MySQL.

Documentation of generated SQL

Optionally, Hibernate will generate SQL statements with embedded comments, to make it easy to discover the source of a misbehaving query.

Improvements to custom types

Three minor improvements have been made to custom type support:

  • custom types may now be given short names (the <typedef> mapping element)
  • custom types may now be parametrized, with parameter values specified in the <typedef>
  • UserType now defines additional operations, to allow customization of how the type is stored in the second-level cache
  • addition of EnhancedUserType, UserVersionType, UserCollectionType for specialized uses

Better support for cursors

Hibernate 2.1.6 provides a much improved implementation of Query.scroll(). Hibernate3 capitalizes upon this by also supporting the use of scroll() with native SQL and Criteria queries.

Introduction of CacheMode

It is possible to control the interaction between the session and second-level cache, dynamically, by specifying a CacheMode.

Support for update by ROWID on Oracle

Hibernate3 can use the Oracle ROWID in SQL UPDATE statements.

Bulk update and delete queries

HQL now supports EJB3-style bulk UPDATE and bulk DELETE queries.


Hibernate 3.1

Hibernate 3.1 is the world's most sophisticated ORXM (Object/Relational/XML Mapping) solution. Hibernate 3.1 is an evolutionary update of Hibernate 3.0. The focus is upon features for offline batch processing.

New StatelessSession API

For bulk/batch processing

HQL bulk operations

  • Efficient UPDATE and DELETE queries for all inheritance mapping strategies
  • INSERT ... SELECT ... queries

Break processing

Support for FETCH JOIN in queries called using scroll()

HQL with clause

To add "extra" restrictions to an association join

Support for huge collections

Introduction of lazy="extra" for collection mappings

Schema Validation

Hibernate may now automatically validate mappings against an existing database schema, to make testing your mappings a breeze.


Hibernate 3.2

The main focus for the Hibernate Core 3.2 release is Java Persistence compliance.

(TBC)


Hibernate Annotations

After the 3.2.0.GA release, the focus of Hibernate Annotations are improvements to Hibernate Lucene and Hibernate Validator.

Hibernate Lucene

Lucene is a powerful index based search engine but requires you to manually populate the index and keep it in sync with your database state. Besides that, when querying a Lucene index, you end up manipulating Lucene Document and no your actual OO Domain Model.

Hibernate Lucene aims to solve both issues by keeping the Lucene index up to date with the changes made through Hibernate. It also allows you to query the Lucene index are get managed entities as a result.

3.2.0.GA contains a synchronized implementation that keep the Lucene index up to date

Hibernate Lucene 3.3 series will contains support for:

  • more efficient index synchronization mechanism
  • Bridge system aiming to convert your property into a index compliant representation (done)
  • Indexing of class hierarchy (done)
  • Query facility support (done)
  • ability to reindex an element manually
  • support for attribute and getter annotations
  • Notion of FieldBridge

We are interested to hear your feedback http://forum.hibernate.org

Hibernate Validator

Hibernate Validator still have room for improvement and will implement JSR 303: Bean Validation when ideas will converge in the Expert Group.

We are interested to hear your feedback http://forum.hibernate.org

Hibernate Annotations

Some Hibernate specific features still have no Annotation representations esp:

  • SQL overriding support

Hibernate EntityManager

Hibernate EntityManager primary goal (EJB 3.0 implementation) is now achieved. However, we are open to user feedbacks to make Hibernate EntityManager evolved (and as breeding-ground of features to be contributed back to a future revision of the specification)


Hibernate Tools

Reverse engineering from JDBC into Hibernate mapping metadata

  • Write a reverse engineering module that uses JDBC metadata to build up a Hibernate Configuration (the root object of a hibernate mapping model). This will eventually replace the Middlegen for Hibernate plugin (DONE)
  • The reverse engineering will be extended to support different naming and modeling strategies, to support "minimal human intervention" in the preparation and execution of the reverse engineering. (DONE)
  • The naming and modeling strategies can be specified in code, external files, and inside the Eclipse integration. (DONE)

Template-based code generation

  • Implement template based code generation, using the internal Hibernate metadata model. This code generation has support for generating POJO .java, hibernate.cfg.xml and .hbm.xml files. (DONE)
  • Use the code generator for reverse engineering to a complete set of mapping metadata and POJO's, or just annotated POJO's if you use EJB3 Annotations. (DONE)
  • Use the code generation in a converter, e.g. for migration from a .hbm.xml based mapping to e.g. EJB3 annotations. (DONE - via ant)
  • Users can provide their own custom templates to override (DONE) or extend (PLANNED) the generated artifacts.

Ant-based tasks

  • Unify the existing Ant tasks and provide support for the new code generation. (DONE)

Eclipse integration

  • Integrate into existing development environments. The first target platform will be Eclipse, it is open source and widely used. (DONE)
  • Provide wizards for the reverse engineering and code generation. (DONE)
  • Provide the features of the Hibernate tools in a more light weight edition, possibly as a standalone client, based on Eclipse RCP. (PLANNED)

Metadata/mapping editor

  • An editor for Hibernate XML mapping files, supporting auto-completion, syntax highlighting, semantic auto-completion for class names and property/field names. (DONE)
  • Semantic auto-completion support for shorthand names in extension points (identifier generation strategies, etc.) and even on tables, columns etc. (DONE)
  • Simple navigation between mapping metadata and Java source code. (DONE)
  • Provide context help on tags, attributes etc. from the Hibernate documentation. (ALPHA for XML/DTD, PLANNED)
  • Provide source generation for properties/association. (PLANNED)
  • Participate in refactoring and search operations inside Eclipse. (PLANNED)
  • Make all relevant features available for EJB3/annotation-based entity beans. (DONE)

Hibernate Console

  • The console is a new perspective in Eclipse. In addition to a tree overview of console configurations, offer an interactive view of persistent classes and their relationships. The console allows to execute HQL queries against a database and browse the result directly in Eclipse. (DONE)
  • Views will be extended to visualize the table structure (ER-like), class structure (UML-like) and the mapping between them. (PLANNED)
  • Provide execution for Criteria API (DONE) and native SQL queries. (PLANNED)
  • Provide an HQL editor (DONE) with syntax highlighting and completion of class and property names. (DONE)
  • Provide a tabular view of the result. (DONE)
  • Allow editing of property values in context of the current session/transaction. (BETA)
  • Show the fetched object graph in a tree and possibly graph view. Allow the user to see how his fetching strategies are applied. Should also be able to explore/navigate the object graph. (PLANNED)

Statistics and event viewer

  • Provides a view using the statistics module in Hibernate3. (DONE - standalone swing)
  • Link HQL queries to the actual executed SQL. (PLANNED)

NHibernate 1.0

NHibernate 1.0 is a source port of Hibernate 2.1 to .NET Framework version 1.1. It is a stable and complete object/relational mapping solution with all functionality needed by a typical .NET web application.

NHibernate 1.2

The 1.2 series of releases of NHibernate brought many improvements and new features:

  • Support for .NET 2.0 generics and nullable types
  • Support stored procedures and custom SQL queries
  • Projections
  • "not-found" attribute on <many-to-one> and <many-to-many>
  • Support for DetachedCriteria
  • Support for MultiQuery
  • Subselect fetching
  • NHibernate Filters (<filter-def> and <filter>)
  • Formula-based discriminator
  • Support for .NET connection string in web.config/app.config
  • Memcache cache provider
  • SysCache2 cache provider
  • Command batching for SQL Server and Oracle
  • Addition and improvements of dialects

NHibernate 2.0

The upcoming NHibernate 2.0 release will add support for many more exciting features; some are ported from Hibernate 3.x, others are features unique to NHibernate.

Core

  • Updated Interceptor functionalities to match those in Hibernate 3.2
  • Support for SessionFactory events and listeners
  • CriteriaTransformer allows one to clone and transform ICriteria
  • Support for MultiCriteria; similar to MultiQuery implemented in NH1.2
  • Support for the <join> element. It enables table-per-subclass mapping using a discriminator, or mapping a single entity from more than one tables
  • StatelessSession provides an easier way to work with bulk operations
  • Support for CacheMode allows one to have better control on how the session interacts with the second-level cache
  • Implementation of query plan; NHibernate will parse named queries once at start-up time, thus improving performance
  • Support of native ID generator for <idbag>
  • Improved and more consistent syntax for configuration
  • Other internal improvements

Sub-projects

  • NHibernate.Linq (a LINQ provider for NHibernate)
  • NHibernate.Statistics

Future Versions

The following features are being considered for future versions of NHibernate:

  • Union subclass
  • Lazy columns
  • Observable collections
  • Entity name

Help is always welcome and contributed patches will be applied as soon as possible, provided they are in good shape. If you need some guidance on how to get started with the NHibernate source code, please have a read of this article: http://www.hibernate.org/428.html. JIRA issue NH-616 (Entry-Level Task List) lists some easy issues that you could work on if you want to contribute but don't know where to start.

© Copyright 2006, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc. [Privacy Policy]