{"id":20535664,"url":"https://github.com/svoxeldev/ebean-wrapper","last_synced_at":"2025-07-12T23:33:42.896Z","repository":{"id":37912058,"uuid":"290210168","full_name":"sVoxelDev/ebean-wrapper","owner":"sVoxelDev","description":"An ebean wrapper that shades all of the required dependencies and drivers exposing them as a single package.","archived":false,"fork":false,"pushed_at":"2025-01-02T02:48:49.000Z","size":416,"stargazers_count":0,"open_issues_count":21,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-01-02T03:32:51.926Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sVoxelDev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-25T12:33:18.000Z","updated_at":"2021-11-20T17:51:47.000Z","dependencies_parsed_at":"2023-11-06T03:29:23.882Z","dependency_job_id":"93fa3eda-e70c-42ca-9583-5df049f02347","html_url":"https://github.com/sVoxelDev/ebean-wrapper","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":"sVoxelDev/spigot-plugin-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sVoxelDev%2Febean-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sVoxelDev%2Febean-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sVoxelDev%2Febean-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sVoxelDev%2Febean-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sVoxelDev","download_url":"https://codeload.github.com/sVoxelDev/ebean-wrapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234210824,"owners_count":18796790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T00:33:15.670Z","updated_at":"2025-01-16T13:50:26.875Z","avatar_url":"https://github.com/sVoxelDev.png","language":"Java","readme":"# ebean-wrapper\n\n[![Build Status](https://github.com/Silthus/ebean/workflows/Build/badge.svg)](../../actions?query=workflow%3ABuild)\n[![GitHub release (latest SemVer including pre-releases)](https://img.shields.io/github/v/release/Silthus/ebean?include_prereleases\u0026label=release)](../../releases)\n[![codecov](https://codecov.io/gh/Silthus/spigot-plugin-template/branch/master/graph/badge.svg)](https://codecov.io/gh/Silthus/ebean)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\nA simple wrapper around the [ebean.io](https://ebean.io) library to provide a one-stop-shop of shading all required dependencies and auto downloading the used driver.\n\n## Usage\n\nDrop the `ebean-wrapper.jar` inside your plugins directory and depend on it, if you are using this wrapper in a Minecraft (Spigot/Paper) server.\n\nAs an alternative you can shade the lib into your application or provide it in the classpath.\n**This is not recommended for Minecraft plugins!**\n\n### Gradle\n\n```groovy\nrepositories {\n    maven { url 'https://jitpack.io' }\n}\n\ndependencies {\n    implementation group: \"net.silthus\", name: \"ebean-wrapper\", version: \"2.10.0\"\n}\n```\n\n### Maven\n\n ```xml\n\u003cproject\u003e\n  ...\n  \u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003ejitpack.io\u003c/id\u003e\n        \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n    \u003c/repository\u003e\n  \u003c/repositories\u003e\n  ...\n  \u003cdependencies\u003e\n    \u003cdependency\u003e\n      \u003cgroupId\u003enet.silthus\u003c/groupId\u003e\n      \u003cartifactId\u003eebean-wrapper\u003c/artifactId\u003e\n      \u003cversion\u003e2.10.0\u003c/version\u003e\n    \u003c/dependency\u003e\n  \u003c/dependencies\u003e\n  ...\n\u003c/project\u003e\n```\n\n### The EbeanWrapper\n\nYou can then create a new instance of the `EbeanWrapper` by providing a `Config` object. Use the config builder `Config.builder()` to create a new instance of the config.\nMake sure you provide a valid driver or create your own `DriverMapping`.\n\n```java\nEbeanWrapper wrapper = new EbeanWrapper(Config.builder()\n    .driver(Driver.MariaDB)\n    .username(\"root\")\n    .password(\"root\")\n    .url(\"jdbc:mysql://localhost:3306/foobar\")\n.build());\n```\n\nYou will also need to add all classes that should be treated as entities to the entities method of the config builder.\n\n```java\nConfig.builder()\n    .entities(\n        User.class,\n        Address.class\n    ).driver(Driver.H2)\n    ...\n    .build();\n```\n\nThe ebean-wrapper will download the required driver by default. You can disable this behaviour my passing `.autoDownloadDriver(false)` to the `ConfigBuilder`.\n\nIf you do that you can control on your own when to download the driver by calling `wrapper.downloadDriver();`.\n\nThen you can open the database connection or directly get the `Database` object, which will also open the connection.\nThe connection will be cached and all subsequent calls to `getDatabase()` use the same connection.\n\n```java\nwrapper.connect();\n// or directly get the database which will connect automatically\nwrapper.getDatabase();\n```\n\n## Drivers\n\nThe ebean wrapper provides the following default driver mappings for auto downloading the appropriate driver.\n\n| Driver | Documentation | ConnectionString |\n| ---- | ----- | ----- |\n| `h2` | [h2database.com](http://www.h2database.com/) | `jdbc:h2:~/test` |\n| `mysql` | [mysql.com](https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-jdbc-url-format.html) | `jdbc:mysql://host:port/database` |\n| `postgres` | [jdbc.postgresql.org](https://jdbc.postgresql.org/documentation/80/connect.html) | `jdbc:postgresql://host:port/database` |\n| `mariadb` | [mariadb.com](https://mariadb.com/kb/en/about-mariadb-connector-j/) | `jdbc:mysql://host:port/database` |\n| `sqlserver` | [docs.microsoft.com](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) | `jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks;integratedSecurity=true;` |\n| `sqlite` | [github.com/xerial/sqlite-jdbc](https://github.com/xerial/sqlite-jdbc) | `jdbc:sqlite:/home/example/mydatabase.db` |\n\n## Migrations\n\n[ebean](http://ebean.io) has great migration support for all of the different database types.\nYou can use this awesome feature by creating the following `Migrations` class inside your test source root.\n\n```java\nimport io.ebean.annotation.Platform;\nimport io.ebean.dbmigration.DbMigration;\n\nimport java.io.IOException;\n\npublic class Migrations {\n\n    public static void main(String[] args) throws IOException {\n\n        DbMigration migration = DbMigration.create();\n\n        // location of the migration changeSet and where ddl is generated to\n        migration.setPathToResources(\"src/main/resources\");\n\n        // add a series of database platforms to generate the ddl for ...\n        migration.addPlatform(Platform.POSTGRES, \"postgres\");\n        migration.addPlatform(Platform.MYSQL, \"mysql\");\n        migration.addPlatform(Platform.MARIADB, \"mariadb\");\n        migration.addPlatform(Platform.H2, \"h2\");\n        migration.addPlatform(Platform.SQLITE, \"sqlite\");\n\n        migration.generateMigration();\n    }\n}\n```\n\nFor this to work you will also need to test depend on all of the different driver implementations.\nAdd the following test dependencies for it to work.\n\n```groovy\n    testImplementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.10.0'\n    testImplementation group: 'com.h2database', name: 'h2', version: '2.10.000'\n    testImplementation group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.10.0'\n    testImplementation group: 'mysql', name: 'mysql-connector-java', version: '2.10.02'\n    testImplementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.32.3.2'\n    testImplementation group: 'org.postgresql', name: 'postgresql', version: '42.2.18'\n```\n\nAlso make sure you enable migrations when creating your `EbeanWrapper` by setting `migrations(this.getClass())` to the class of your application.\n\nThen ebean will automatically run the migrations of all of your entities on start.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvoxeldev%2Febean-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsvoxeldev%2Febean-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvoxeldev%2Febean-wrapper/lists"}