We are getting closer and closer to the final release of Hibernate OGM 5.
This release includes support for Redis Cluster and
a new dialect to store data within Redis hashes; java.util.UUID
are now
using the native uuid
type in Apache Cassandra;
more queries are now supported using the MongoDB CLI syntax.
This release is also aligned to the Hibernate 5 family and it will work with Hibernate ORM 5, Hibernate Search 5.5 and the latest WildFly 10. Check the previous post for more details about it.
The migration notes contains more information about migrating from earlier versions of Hibernate OGM to 5.x.
Have a look at the change log for a list of everything included in this release.
Redis Cluster support
Enabling the support for Redis Cluster is a matter of setting the following property to true
:
hibernate.ogm.redis.cluster = true
When this property is enabled, data will be stored across Redis cluster nodes according to the Redis key distribution model on the hash slot of the key of each entity.
Check the documentation for more details about the configuration options for Redis in Hibernate OGM.
Redis hash mapping
When using this mapping, data is stored using key-values pairs using Redis hashes. The benefit of this approach is that it allows partial updates.
You can enable this dialect setting the following property:
hibernate.ogm.datastore.grid_dialect = org.hibernate.ogm.datastore.redis.RedisHashDialect
This will map the following entity:
@Entity
public class News {
@Id
private String id;
@Version
@Column(name="version")
private int version;
private String title;
private String description;
//getters, setters ...
}
with the following properties:
version = 1
title = On the merits of NoSQL
description = This paper discuss why NoSQL will save the world for good
A huge thanks to community member Mark Paluch, responsible for both these great improvements in the Redis area. Note that these features are both experimental for the time being.
Additional MongoDB native CLI queries support
Thanks to the contribution of Thorsten Möller, Hibernate OGM now supports more type of queries using the MongoDB CLI syntax: findOne, findAndModify, insert, remove and update.
Here an example showing how you can use them:
OgmSession session = ...
String nativeQuery = "db.OscarWilde.findAndModify({"
+ "'query': {'author': 'oscarwilde'}, "
+ "'update': { '$set': { 'author': 'Oscar Wilder' } }, "
+ "'new': true "
+ "})";
Query query = session.createNativeQuery( nativeQuery ).addEntity( OscarWilde.class );
List<OscarWilde> result = query.list();
You can find more details in the documentation about experimental support of native MongoDB queries.
What’s coming next?
We are working on the Neo4j remote dialect and we are focused on releasing a stable version of Hibernate OGM 5.
Where can I get it?
You can get Hibernate OGM 5.0.0.CR1 via Maven etc. using the following coordinates:
-
org.hibernate.ogm:hibernate-ogm-core:5.0.0.CR1 for the Hibernate OGM core module
-
org.hibernate.ogm:hibernate-ogm-<%BACKEND%>:5.0.0.CR1 for the NoSQL backend you want to use, with _<%BACKEND%> being one of "mongodb", "redis", "neo4j", etc.
Alternatively, you can download archives containing all the binaries, source code and documentation from SourceForge.
How can I get in touch?
You can get in touch through the following channels:
-
Stack Overflow: we monitor the tag hibernate-ogm
We are looking forward to hear your feedback!