We’re happy to announce the release of Hibernate OGM 5.3.1.Final.

This is the first maintenance release of the 5.3 branch.

What’s new compared to 5.3.0.Final?

This is a maintenance release fixing issues related to native queries pagination and projection.

Pagination now works perfectly for MongoDB native queries that use aggregates.

You can see a complete list of the changes in the release notes.

This version is fully compatible with 5.3.0.Final.

Components upgrade

  • Hibernate ORM 5.2.16.Final

Projection and addEntity are not allowed in the same query

It is not possible anymore to execute a native query with projection and extract the returned values as an entity list.

Given the entity:

public class Movie {

        private Integer id;
        private String name;
        private String author;
        private Integer year;

        public Movie() {

If we try to get all movies using projection and addEntity:

session.createNativeQuery( "db.Movie.find( {}, { 'id' : 1, 'name' : 1  } )" )
        .addEntity( Movie.class )

An exception will be thrown and this message will be logged:

OGM000091: Projection and addEntity are not allowed in the same query on <Movie>

It is allowed either to use projection without addEntity:

session.createNativeQuery( "db.Movie.find( {}, { 'id' : 1, 'name' : 1  } )" )

Or to use addEntity without projection:

session.createNativeQuery( "db.Movie.find( {} )" )
        .addEntity( Movie.class )

This is true for all dialects supporting native queries, which at the moment of writing those lines are the MongoDB and Neo4j dialects.

This is consistent with the behavior of Hibernate ORM.

Where can I get it?

You can include in your project the dialect of your choice using this Maven coordinates:

  • Infinispan

    • Embedded: org.hibernate.ogm:hibernate-ogm-infinispan-embedded:5.3.1.Final

    • Remote: org.hibernate.ogm:hibernate-ogm-infinispan-remote:5.3.1.Final

  • MongoDB: org.hibernate.ogm:hibernate-ogm-mongodb:5.3.1.Final

  • Neo4j: org.hibernate.ogm:hibernate-ogm-neo4j:5.3.1.Final

Alternatively, you can download archives containing all the binaries, source code and documentation from Sourceforge.

If you are interested about available versions, you can check the official Hibernate OGM download page.

How can I get in touch?

You can find us through the following channels:

We are looking forward to hearing your feedback!

Back to top