• Stars
    star
    421
  • Rank 99,594 (Top 3 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 5 years ago
  • Updated 23 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A reactive API for Hibernate ORM, supporting non-blocking database drivers and a reactive style of interaction with the database.

Hibernate team logo

Main branch build status Apache 2.0 license Latest version on Maven Central Developers stream on Zulip Hibernate Reactive documentation

Hibernate Reactive

A reactive API for Hibernate ORM, supporting non-blocking database drivers and a reactive style of interaction with the database.

Hibernate Reactive may be used in any plain Java program, but is especially targeted toward usage in reactive environments like Quarkus and Vert.x.

Currently PostgreSQL, MySQL, MariaDB, Db2, CockroachDB, MS SQL Server and Oracle are supported.

Learn more at http://hibernate.org/reactive.

Compatibility

Hibernate Reactive has been tested with:

Documentation

The Introduction to Hibernate Reactive covers everything you need to know to get started, including:

We recommend you start there!

The Vert.x and Hibernate Reactive How-to explains how to use Hibernate Reactive in Vert.x.

The Hibernate Reactive with Panache Guide introduces Panache Reactive, an active record-style API based on Hibernate Reactive.

Examples

The directory examples contains several small projects showing different features of Hibernate Reactive:

Quarkus quickstarts

A collection of quickstarts for Quarkus is available on GitHub:

Or you can generate a new Quarkus project that uses the Hibernate Reactive extension and start coding right away.

Examples using JBang

With JBang you can run one of the examples available in the catalog without having to clone the repository or setup the project in the IDE. Once you have downloaded JBang, the list of examples is available via:

jbang alias list hibernate/hibernate-reactive

If you want to run one of the example (in this case the one called example), you can do it with:

jbang example@hibernate/hibernate-reactive

or you can open it in your editor (IntelliJ IDEA in this case) with:

jbang edit --open=idea testcase@hibernate/hibernate-reactive

You can also generate and run a db-specific test. See available templates using: jbang template list

cockroachdb-reproducer = Template for a test with CockroachDB using Junit 4, Vert.x Unit and Testcontainers
db2-reproducer = Template for a test with Db2 using Junit 4, Vert.x Unit and Testcontainers
mariadb-reproducer = Template for a test with MariaDB using Junit 4, Vert.x Unit and Testcontainers
mysql-reproducer = Template for a test with MySQL using Junit 4, Vert.x Unit and Testcontainers
pg-reproducer = Template for a test with PostgreSQL using Junit 4, Vert.x Unit and Testcontainers

Example for PostgreSQL:

  • Generate java test from template: jbang init --template=pg-reproducer pgTest.java
  • Run the test: jbang pgTest.java

Gradle build

The project is built with Gradle, but you do not need to have Gradle installed on your machine.

Building

To compile this project, navigate to the hibernate-reactive directory, and type:

./gradlew compileJava

To publish Hibernate Reactive to your local Maven repository, run:

./gradlew publishToMavenLocal

Building documentation

To build the API and Reference documentation type:

./gradlew assembleDocumentation

You'll find the generated documentation in the subdirectory release/build/documentation.

open release/build/documentation/reference/html_single/index.html
open release/build/documentation/javadocs/index.html

Running tests

To run the tests, you'll need to decide which RDBMS you want to test with, and then get an instance of the test database running on your machine.

By default, the tests will be run against PostgreSQL. To test against a different database, you must explicitly specify it using the property -Pdb, as shown in the table below.

Database Command
PostgreSQL ./gradlew test -Pdb=pg
MySQL ./gradlew test -Pdb=mysql
MariaDB ./gradlew test -Pdb=maria
DB2 ./gradlew test -Pdb=db2
SQL Server ./gradlew test -Pdb=mssql
Oracle ./gradlew test -Pdb=oracle

It's even possible to run all tests or certain selected tests on all available databases:

./gradlew testAll -PincludeTests=DefaultPortTest

The property includeTests specifies the name of the test to run and may contain the wildcard *. This property is optional, but very useful, since running all tests on all databases might take a lot of time.

To enable logging of the standard output streams, add the property -PshowStandardOutput.

There are three ways to start the test database.

If you have Docker installed

If you have Docker installed, running the tests is really easy. You don't need to create the test databases manually. Just type:

./gradlew test -Pdocker

The above command will start an instance of PostgreSQL in a Docker container. You may specify a different database using one of the commands show in the table below.

Database Command
PostgreSQL ./gradlew test -Pdocker -Pdb=pg
MySQL ./gradlew test -Pdocker -Pdb=mysql
MariaDB ./gradlew test -Pdocker -Pdb=maria
DB2 ./gradlew test -Pdocker -Pdb=db2
SQL Server ./gradlew test -Pdocker -Pdb=mssql
Oracle ./gradlew test -Pdocker -Pdb=oracle

The tests will run faster if you reuse the same containers across multiple test runs. To do this, edit the testcontainers configuration file .testcontainers.properties in your home directory, adding the line testcontainers.reuse.enable=true. (Just create the file if it doesn't already exist.)

If you already have PostgreSQL installed

If you already have PostgreSQL installed on your machine, you'll just need to create the test database. From the command line, type the following commands:

psql
create database hreact;
create user hreact with password 'hreact';
grant all privileges on database hreact to hreact;
alter user hreact createdb;

Then run ./gradlew test from the hibernate-reactive directory.

If you already have MySQL installed

If you have MySQL installed, you can create the test database using the following commands:

mysql -uroot
create database hreact;
create user hreact identified by 'hreact';
grant all on hreact.* to hreact;

Then run ./gradlew test -Pdb=mysql from the hibernate-reactive directory.

If you have Podman

If you have Podman installed, you can start the test database by following the instructions in podman.md.

Limitations

We're working hard to support the full feature set of Hibernate ORM. At present several minor limitations remain.

  • The annotation @org.hibernate.annotations.Source for database-generated @Version properties is not yet supported.
  • The annotation @org.hibernate.annotations.CollectionId is not yet supported.
  • With Db2:

More Repositories

1

hibernate-orm

Hibernate's core Object/Relational Mapping functionality
Java
5,754
star
2

hibernate-validator

Hibernate Validator - Jakarta Bean Validation Reference Implementation
Java
1,170
star
3

hibernate-search

Hibernate Search: full-text search for domain model
Java
490
star
4

hibernate-ogm

Hibernate OGM - Domain model persistence for NoSQL datastores
Java
319
star
5

hibernate-tools

Code generation, reverse engineering, ant task and more tools for Hibernate Core
Java
299
star
6

hibernate-demos

Repository for demos of various Hibernate projects
Java
272
star
7

hibernate-shards

Horizontal partitioning for Hibernate O/RM
Java
92
star
8

query-validator

Compile time validation for HQL and JPQL queries in Java code
Java
82
star
9

hibernate-test-case-templates

Templates and examples to report issues to Hibernate
Java
59
star
10

gradle-maven-publish-auth

Gradle plugin for managing authentication of upload tasks
Java
42
star
11

hibernate-metamodelgen

Annotation Processor to generate JPA 2 static metamodel classes
Java
33
star
12

hibernate-jpa-api

Clean-room definition of JPA APIs intended for transitory use in Hibernate JPA development
32
star
13

hibernate-hql-parser

New experimental parser for JP-QL queries
Java
30
star
14

hibernate-commons-annotations

Hibernate Commons Annotations project
Java
28
star
15

hibernate.org

Source for the hibernate.org website
JavaScript
28
star
16

hibernate-ogm-ignite

Hibernate OGM dialect for Apache Ignite
Java
16
star
17

hibernate-ogm-cassandra

Hibernate OGM integration with Cassandra
Java
10
star
18

hibernate.github.io

Legacy GitHub Pages deployment for https://hibernate.org. This repository is obsolete and is not longer used.
HTML
8
star
19

hibernate-infra

Configuration of Hibernate project infrastructure: CI, websites, bot deployment.
Shell
8
star
20

hibernate-semantic-query

Semantic query model and interpreter for HQL/JPQL and JPA Criteria queries
Java
8
star
21

hibernate-ide-codestyles

IDE code-styles for Hibernate projects
7
star
22

lucene-jbossmodules

Repackaging the Apache Lucene libraries to be deployed as modules in WildFly
Java
7
star
23

hibernate-ogm-redis

Hibernate OGM integration with Redis
Java
6
star
24

in.relation.to

Source for the in.relation.to website
HTML
5
star
25

gradle-xjc-plugin

A Gradle plugin for performing XJC for generating a JAXB binding model from an XSD
Java
4
star
26

hibernate-matrix-testing

Support for running tests against a number of database profiles
Java
4
star
27

version-injection-plugin

Gradle plugin used by Hibernate to inject project version into compiled classes
Java
4
star
28

hibernate-presentations

Hibernate presentations
Ruby
4
star
29

jakarta-transformer-plugin

Java
3
star
30

hibernate-jenkins-pipeline-helpers

Hibernate helpers for Jenkins pipelines
Groovy
3
star
31

quarkus-local-cache

A Hibernate Cache optimised for Quarkus
3
star
32

beanvalidation-benchmark

A benchmark for Bean Validation implementations
Java
3
star
33

hibernate-asciidoctor-extensions

Asciidoctor extensions developed for the Hibernate projects
Java
3
star
34

gson-jbossmodules

Repackaging the Gson libraries to be deployed as modules in WildFly
Java
2
star
35

hibernate-ogm-ehcache

Hibernate OGM integration with EhCache
Java
2
star
36

hibernate-ogm-couchdb

Hibernate OGM integration with CouchDB
Java
2
star
37

elasticsearch-client-jbossmodules

Repackaging the Elasticsearch client libraries to be deployed as modules in WildFly
Java
2
star
38

hibernate-noorm-release-scripts

Older release scripts for Hibernate projects (except Hibernate ORM). DEPRECATED: Use https://github.com/hibernate/hibernate-release-scripts instead
Shell
2
star
39

hibernate-models

An abstraction over "reflection" and annotations
Java
2
star
40

hibernate-jdocbook-style

Documentation style
XSLT
1
star
41

aws-v4-signer-java-jbossmodules

Java
1
star
42

hibernate-release-scripts

Shell
1
star
43

hibernate-search-benchmark

Benchmarks for performance testing of Hibernate Search.
Java
1
star
44

database-profile-plugin

Support for testing against multiple databases via profiles
Java
1
star
45

hibernate-search-6-poc

Content was moved to https://github.com/hibernate/hibernate-search/. See readme for more information.
1
star
46

hibernate-github-bot

A bot to handle GitHub events from repositories of the Hibernate organization
Java
1
star
47

docs.hibernate.org

Documentation website for the Hibernate projects
1
star
48

hibernate-search-develocity-extension

A Maven extension to configure Develocity build cache for the Hibernate Search project
Java
1
star