Pustike Persist

An object based persistence library

License

License

GroupId

GroupId

io.github.pustike
ArtifactId

ArtifactId

pustike-persist
Last Version

Last Version

0.9.2
Release Date

Release Date

Type

Type

jar
Description

Description

Pustike Persist
An object based persistence library
Project URL

Project URL

https://github.com/pustike/pustike-persist

Download pustike-persist

How to add to project

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

Dependencies

test (4)

Group / Artifact Type Version
com.zaxxer : HikariCP jar 4.0.0
org.postgresql : postgresql jar 42.2.18
org.junit.jupiter : junit-jupiter-api jar 5.7.0
org.junit.jupiter : junit-jupiter-engine jar 5.7.0

Project Modules

There are no modules declared in this project.

Pustike Persist

Persist is an object based persistence library. Using a simple configuration and annotation based entity mapping, it provides features like schema generation, sql query api to insert / update / delete objects and a fluent data finder api.

Using Java Persistence API is the standard approach to object persistence in Java based applications. And it is a comprehensive and complex API to implement and use. Using a JPA implementation for persistence can add lot of overhead to small/medium sized applications. So, Pustike Persist provides a simple api to perform common SQL queries using object metadata built using JPA like annotations.

Following are some of its key features:

  • Repository configuration using dataSource and schema metadata
  • Entity mapping to database table and fields to columns using annotations
  • Database schema generation with indexes, foreign keys, constraints, etc using the mapping tool
  • Allows field group definitions per entity to fetch or update only the required data
  • Insert single/list of objects into database in batch and support update on conflict using excluded rows
  • Update single/multiple objects in the database using the specified field group
  • Select row data as object with the given identity and option to select them for update with lock
  • Delete single/multiple objects
  • A fluent Finder API to construct sql queries and fetch result data as objects
  • Supported databases: PostgreSQL
  • Requires Java 11 and has no external dependencies (~60kB in size)

Documentation: Latest javadocs is available here.

Todo:

  • Write unit tests using test container
  • More detailed documentation
  • Support readOnly transactions
  • Allow multiple schema definitions per repository
  • Override field name when using field@fgName instead of adding both
  • Finder API - add fetch(String fgName) as a method to reduce the number of overloaded fetch methods
  • MappingTool - create ForeignKey column based on the type of @Id column
  • MappingTool - if existing field metadata is changed, compare with the database and show warnings
  • Add support for Composite primary key
  • Implement L1 Cache to avoid creating same object multiple times
  • Support more databases (MySQL, H2, HSQLDB, Derby)

Download

To add a dependency using Maven, use the following:

<dependency>
    <groupId>io.github.pustike</groupId>
    <artifactId>pustike-persist</artifactId>
    <version>0.9.2</version>
</dependency>

Or, download the latest JAR

License

This library is published under the Apache License, Version 2.0

io.github.pustike

Pustike

Versions

Version
0.9.2
0.9.0