Hibernete adapter for Casbin

Clone this repo:
  1. 2b23b50 feat: remove useless update code in insertData() by Yang Luo · 10 months ago master v1.5.0
  2. adc99f9 feat: Support mariadb datasource (#21) by happened · 10 months ago v1.4.0
  3. 484cf88 feat: fix pom.xml to fix CI for publishing to https://central.sonatype.com (#17) by Liao Xin · 1 year, 6 months ago v1.3.0
  4. 47bcaf0 feat: update README.md by hsluoyz · 2 years, 3 months ago v1.2.0
  5. 6598c4d fix: fix CI Node.js version (#15) by Xu Zerui · 2 years, 3 months ago v1.1.0

Hibernate Adapter for jCasbin

codebeat badge GitHub Actions Coverage Status javadoc Maven Central Discord

Load policy from Hibernate or save policy to it.

Usage

First, Introduce it in the pom.xml:

<dependency>
    <groupId>org.casbin</groupId>
    <artifactId>hibernate-adapter</artifactId>
    <version>1.0.0</version>
</dependency>

Then you can use it in your project like this:

Enforcer e = new Enforcer("examples/rbac_with_domains_model.conf");
Adapter adapter = new HibernateAdapter(DRIVER, URL, USERNAME, PASSWORD, true);
e.setAdapter(adapter);
e.loadPolicy();

If you use Oracle, the last entry of the parameter must be set to true.

Supported Databases

Currently supported databases:

MySQL
Oracle
SQL Server 2012