HomeJavaModsJEHibernate
JEHibernate

[​IMG] [​IMG] [​IMG]

JEHibernate 3.0
Modern Hibernate/JPA Utility Library for Minecraft Plugins

What is JEHibernate?

JEHibernate eliminates 65%+ of database boilerplate code in your Spigot/Paper plugins. It wraps Hibernate ORM with a clean, fluent API designed specifically for the Minecraft plugin lifecycle — async operations that don't block the main thread, cached repositories for fast player lookups, and session-scoped lazy loading that actually works.

Works with: Spigot, Paper, Folia, and Java Spring applications.
Supports: Java 17, 21, and 24 (virtual threads automatically enabled on 21+).

Key Features

Quick Example

1. Define an Entity
Code (Java):

@ Entity
public class PlayerData extends UuidEntity {
    private String username ;
    private long balance ;
    private long playtime ;

    protected PlayerData ( ) { }

    public PlayerData (UUID uuid, String username ) {
        setId (uuid ) ;
        this. username = username ;
    }

    // Getters and setters...
}
 
2. Define a Repository
Code (Java):

public class PlayerRepository extends AbstractCachedRepository <PlayerData, UUID, UUID > {
    public PlayerRepository (ExecutorService ex, EntityManagerFactory emf, Class <PlayerData > cls ) {
        super (ex, emf, cls, PlayerData ::getId,
            CacheConfig. builder ( )
                . expiration (Duration. ofMinutes ( 30 ) )
                . maxSize ( 5000 )
                . expireAfterAccess ( true )
                . build ( ) ) ;
    }
}
 
3. Use in Your Plugin
Code (Java):

public class MyPlugin extends JavaPlugin {
    private JEHibernate jeHibernate ;

    @Override
    public void onEnable ( ) {
        saveResource ( "database/hibernate.properties", false ) ;

        jeHibernate = JEHibernate. builder ( )
            . configuration (config -> config. fromProperties (
                PropertyLoader. load (getDataFolder ( ), "database", "hibernate.properties" ) ) )
            . scanPackages ( "com.example.myplugin" )
            . build ( ) ;

        var playerRepo = jeHibernate. repositories ( ). get (PlayerRepository. class ) ;
        playerRepo. preloadAsync ( ) ; // non-blocking cache warmup
    }

    @Override
    public void onDisable ( ) {
        jeHibernate. close ( ) ;
    }
}
 
Why JEHibernate Over Raw SQL / JDBC?


Supported Databases

Database Config Prefix Driver (auto-detected)
H2 h2 org.h2.Driver
MySQL mysql com.mysql.cj.jdbc.Driver
MariaDB mariadb org.mariadb.jdbc.Driver
PostgreSQL postgresql org.postgresql.Driver
SQLite sqlite org.sqlite.JDBC
Oracle oracle oracle.jdbc.OracleDriver
SQL Server mssql com.microsoft.sqlserver.jdbc.SQLServerDriver
HSQLDB hsqldb org.hsqldb.jdbc.JDBCDriver


Entity Base Classes

All base classes provide automatic createdAt/ updatedAt timestamps, optimistic locking via [USER=24464]@version[/USER], and correct equals/ hashCode.


Dependency (Gradle)

Code (Text):

dependencies {
    implementation("de.jexcellence.hibernate:JEHibernate:3.0.0")
    runtimeOnly("com.h2database:h2:2.4.240")  // or your database driver
}
 
Dependency (Maven)

Code (XML):

<dependency>
    <groupId>de.jexcellence.hibernate </groupId>
    <artifactId>JEHibernate </artifactId>
    <version>3.0.0 </version>
</dependency>
 

Licensed under Apache 2.0 | GitHub
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

JEHibernate is a free Minecraft Java mod. Compatible with Minecraft 1.17, 1.18, 1.19, 1.20 and newer. Downloaded 31 times (via Spigot). Download it and open it directly in the game.

Explore more