Introduction
Changelog
Contact
Guides
Getting Started
Entities
Repositories
Queries & Specifications
Configuration & Pooling
Migrations
Spring Boot
Spigot & Paper Plugins
Recipes
Reference
Databases
Troubleshooting
Advanced
Multi-tenancy
Audit Trail
Testing
TrademarkTrademark
Ctrl k
Search…
Get started
Introduction
Changelog
Contact
Guides
Getting Started
Entities
Repositories
Queries & Specifications
Configuration & Pooling
Migrations
Spring Boot
Spigot & Paper Plugins
Recipes
Reference
Databases
Troubleshooting
Advanced
Multi-tenancy
Audit Trail
Testing
TrademarkTrademark© Aveiro. All rights reserved.
Built with Aveiro
Guide

Spigot & Paper Plugins

Load configuration from the plugin data folder, run database work off the main thread, and shade JEHibernate correctly.
Updated last month
Spring Boot
Recipes
JEHibernate was shaped by the Minecraft plugin lifecycle. The jehibernate-plugin module adds the data-folder convenience; everything else is in core.

Configuration from the data folder

Ship a hibernate.properties in your jar and let JEHibernate copy and read it from the plugin data folder, so server admins can change databases without touching code. The file lives at src/main/resources/database/hibernate.properties; admins edit the copy in the data folder.

Never block the main thread

Database calls must not run on the server thread. Use the async API, then hop back with the scheduler to touch Bukkit state. Cached repositories make hot lookups (online players) instant without a round trip — see Repositories.

Shading JEHibernate into your plugin

If you shade dependencies into your plugin jar, do not relocate org.slf4j. Paper already provides slf4j-api and a Log4j2-backed provider on the plugin classpath; an un-relocated facade binds to the server console. Relocating it without also bundling a provider produces this at startup:
public final class MyPlugin extends JavaPlugin {
    private JEHibernate jeHibernate;

    @Override
    public void onEnable() {
        jeHibernate = JEHibernate.fromProperties(getDataFolder(), "database", "hibernate.properties");
    }

    @Override
    public void onDisable() {
        if (jeHibernate != null) jeHibernate.close();   // shuts the pool down
    }
}
players.findByIdAsync(uuid).thenAccept(opt ->
    Bukkit.getScheduler().runTask(this, () ->
        opt.ifPresent(data -> player.sendMessage("Balance: " + data.getBalance()))));
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
and silently drops every JEHibernate log. In your shadow configuration, leave org.slf4j un-relocated (or exclude org.slf4j:slf4j-api from the shaded jar). If you must relocate everything, add a provider (slf4j-jdk-platform-logging or slf4j-simple) so its service file is relocated with it.
This warning is not from JEHibernate
It comes from your plugin's shading. slf4j-api reaches the jar transitively (via the reflection scanner), so the library cannot fix a relocation that drops the provider. See Troubleshooting for all three fixes.

Folia

JEHibernate runs on Folia. Keep database work off region threads the same way — async queries, then schedule back onto the correct region/global scheduler to apply results.