For the first Hibernate OGM release of the year, I’m happy to announce Hibernate OGM 5.2 CR1.
This will become the next 5.2 Final soon and we added support for Geospatial integration and new native operator support with MongoDB, Neo4j queries performance improvements and integration with cluster counters for Infinispan embedded.
If you need to upgrade from a version before 5.2, you can find help on the migration notes.
All the changes are described in the release notes.
Infinispan embedded sequences and id generation
When using the Infinispan embedded dialect, Hibernate OGM will now exploit clustered counters for id generation and sequences. If you are not familiar with them you can find more details in the Infinispan documentation
At the moment, Infinispan only support counters for clustered caches, for this reason, Hibernate OGM won’t be able to generate id or sequences if you are using local caches. The Infinispan team is working on this and we are going to fix it as soon as possible. Keep an eye on issue OGM-1376 if you want to be up-to-date.
We also changed the name of the artifact, the artifact to be included in the POM is now the following:
<dependency>
<groupId>org.hibernate.ogm</groupId>
<artifactId>hibernate-ogm-infinispan-embedded</artifactId>
<version>5.2.0.CR1</version>
</dependency>
Neo4j performance
Thanks to feedback from Klaas Dellschaft, we found out we were doing inefficient queries when loading entities from Neo4j. Issue OGM-1344 contains more information.
MongoDB geospatial and native API
Hibernate OGM now supports the ability to declare geospatial fields by using specific Java types that will be automatically converted to GeoJSON objects stored in MongoDB. Here’s an example:
@Entity
@Table(indexes = {
@Index(columnList = "location", name = "location_spatial_idx")
})
@IndexOptions(
@IndexOption(forIndex = "location_spatial_idx", options = "{ _type: '2dsphere' }")
)
public class Restaurant {
// [...]
GeoPoint location;
}
More details in the Hibernate OGM documentation.
We also improved the MongoDB native CLI API with the addition of new operations: replaceOne, updateMany, updateOne, deleteMany, deleteOne, insertMany, insertOne.
Here’s an example of a native query:
String nativeQuery = "db.Poem.remove({ '_id': { '$numberLong': '11' } })";
session.createNativeQuery( nativeQuery ).executeUpdate();
Where can I get it?
You can include in your project the dialect of your choice using this maven coordinates:
Alternatively, you can download archives containing all the binaries, source code and documentation from Sourceforge.
If you are intersted about availabe versions, you can check the official Hibernate OGM download page.
What’s next?
We are going to release 5.2 Final and work on 5.3. Hibernate OGM 5.3 development will be focused on the HIbernate ORM 5.2 upgrade.
How can I get in touch?
You can find us through the following channels:
-
Stack Overflow: we monitor the tag hibernate-ogm
-
Zulip: Hibernate OGM Zulip stream
We are looking forward to hearing your feedback!