com.github.gentity:gentity-test-eclipselink

JPA Entity class generator from DBSchema (*.dbs) database models (see https://www.dbschema.com)

License

License

Categories

Categories

CLI User Interface EclipseLink Data ORM
GroupId

GroupId

com.github.gentity
ArtifactId

ArtifactId

gentity-test-eclipselink
Last Version

Last Version

0.26
Release Date

Release Date

Type

Type

jar
Description

Description

JPA Entity class generator from DBSchema (*.dbs) database models (see https://www.dbschema.com)
Project Organization

Project Organization

The Gentity Project

Download gentity-test-eclipselink

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.gentity/gentity-test-eclipselink/ -->
<dependency>
    <groupId>com.github.gentity</groupId>
    <artifactId>gentity-test-eclipselink</artifactId>
    <version>0.26</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.gentity/gentity-test-eclipselink/
implementation 'com.github.gentity:gentity-test-eclipselink:0.26'
// https://jarcasting.com/artifacts/com.github.gentity/gentity-test-eclipselink/
implementation ("com.github.gentity:gentity-test-eclipselink:0.26")
'com.github.gentity:gentity-test-eclipselink:jar:0.26'
<dependency org="com.github.gentity" name="gentity-test-eclipselink" rev="0.26">
  <artifact name="gentity-test-eclipselink" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.gentity', module='gentity-test-eclipselink', version='0.26')
)
libraryDependencies += "com.github.gentity" % "gentity-test-eclipselink" % "0.26"
[com.github.gentity/gentity-test-eclipselink "0.26"]

Dependencies

compile (2)

Group / Artifact Type Version
com.github.gentity : gentity-test jar 0.26
com.github.gentity : gentity-lib jar 0.26

test (3)

Group / Artifact Type Version
junit : junit jar 4.13.1
org.eclipse.persistence : eclipselink jar 2.7.5
org.hsqldb : hsqldb jar 2.4.0

Project Modules

There are no modules declared in this project.

gentity Build Status Maven

JPA Entity class generator from MySQL Workbench (.mwb) and DBSchema (.dbs) database models.

The Workflow:

  1. Create/modify database model in modeller tool (MySQL Workbench / DbSchema)
  2. Run gentity from Maven or directly from command line to generate entity classes

So, Gentity doesn't need a running database; entity classes are generated directly from the modeller file. Perfect for build automation!

Documentation

  • The Wiki contains an in-depth discussion on usage and concepts
  • Keep on reading below for a quick start!

Features

  • Automatic entity generation from table schema
  • Automatically derives:
    • Entity fields from column definitions
    • OneToMany / OneToOne / ManyToMany relations from foreign key and index definitions
    • Non-Entity collections (@ElementCollection / @Embeddable)
  • Additional mapping definition file, to
    • Override derived definitions from database modeller file
    • Define inheritance hierarchies (supported strategies are JOINED and SINGLE_TABLE)
  • Bidirectional and unidirectional relationships are supported
  • Mutual update of bidirectional relations (when one side is updated, the other is updated automagically)
  • External (non-generated) superclasses and superinterfaces for generated entities
  • Supported database modellers:

Quick Start

Add this to your pom.xml's <build>/<plugins> section:

<plugin>
    <groupId>com.github.gentity</groupId>
    <artifactId>gentity-maven-plugin</artifactId>
    <version>0.17</version>  <!-- replace with newest release version -->
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <inputDbsFile>my-db-model.dbs</inputDbsFile>
            </configuration>
        </execution>
    </executions>
</plugin>

You'll also need the gentity library (gentity-lib):

<dependency>
    <groupId>com.github.gentity</groupId>
    <artifactId>gentity-lib</artifactId>
    <version>0.17</version>  <!-- must match the gentity plugin version -->
</dependency>

Note that you'll also need your ORM's libraries (EclipseLink, Hibernate, etc.), or at least the JPA API:

TODO

  • Support for unidirectional OneToMany (this has issues attached, as standard JPA defaulting requires a join table - however, JPA 2.2 also supports them without one, but that has implications)
  • Per Class inheritance
  • Provide better error output, especially for the mapping config file explaining where in the file to look for errors. See this post on how to do this for our deserialized mapping config info: https://stackoverflow.com/questions/7079796/jaxb-location-in-file-for-unmarshalled-objects

Maven Central shield image from shields.io

Versions

Version
0.26
0.25
0.24
0.23