Paul2708 / worm

Worthless Object Relation Mapper for Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

worm

worm (Worthless Object Relation Mapper) is an ORM for Java that is inspired by JPA and Spring Data.

To get started, check out the wiki or jump right into the quick start below.

Quick Start

  1. Add worm as a dependency.

Maven

<repository>
    <id>eldonexus</id>
    <url>https://eldonexus.de/repository/maven-public/</url>
</repository>

<dependency>
    <groupId>de.paul2708</groupId>
    <artifactId>worm</artifactId>
    <version>0.2.0</version>
</dependency>

Gradle

repositories {
    maven("https://eldonexus.de/repository/maven-public/")
}

dependencies {
    implementation("de.paul2708:worm:0.2.0")
}
  1. Define an entity.
@Entity("persons")
public class Person {

  @Identifier
  @MaxLength(128)
  @Attribute("email_address")
  private String email;

  @Attribute("age")
  private int age;

  @Reference
  @Attribute("partner")
  private Person partner;

  @Attribte("passwords")
  private List<String> passwords;

  public Person() {

  }
}
  1. Create a repository.
public interface PersonRepository extends CrudRepository<Person, String> {

  List<Person> findByAge(int age);
}
  1. Create a MySQL database and store the first entity.
Database database = new MySQLDatabase("localhost", 3306, "database", "user", "password");
PersonRepository repository = Repository.create(PersonRepository.class, Person.class, database);

Person person = new Person();
// ...

repository.save(person);

Contribution

If you want to contribute, just open an issue and check out the work-in-progress contribution wiki.

About

Worthless Object Relation Mapper for Java

License:MIT License


Languages

Language:Java 100.0%