Skip to content

Latest commit

History

260 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

PikaORM

Ah yes, just what we need: another ORM...

PikaORM is an object-relational mapping tool for Java.

PikaORM is designed differently than most other Java ORM tools:

  • It does not require any code-generation
  • It works with POJOs
  • It is configured entirely in code, no config files
  • It doesn't hide the underlying SQL from you
  • The source is in one file, and can be copied-and-pasted into your project if you wish to tweak or fork it

Quick Start

Here is an example of PikaORM in action:

// a POJO model classclassMyModel {
longid;
Stringstr;
}
publicstaticvoidmain(String[] args) {
// create an ORM with a connection stringvarorm = newPikaORM("jdbc:sqlite:demo.db");
// create a new model objectvarmodel = newMyModel();
model.str = "Hello PikaORM";
// save it to the database, get the resulting generated idvarid = orm.insert(model);
// load the model from db by idvarfromDb = orm.find(MyModel.class).byId(id);
// print out "Hello PikaORM"System.out.println(fromDb.str);
}

The MyModel class in this example is a POJO and doesn't know anything about the backing database.

In this case the schema for the table that holds this POJO would look like this:

CREATETABLEmy_models (
id INTEGERPRIMARY KEY,
str_val VARCHARNOT NULL
);

Configuring PikaORM

Default Mapping

  • ClassName -> class_names
  • fieldName -> field_name
  • id -> id column/field name
  • <table_name>_id -> foreign key column/field name
  • version -> optimistic concurrency column/field name

Logging

CRUD with POJOS

CRUD with PikaBeans

Validation in PikaBeans

Raw Queries

PikaQueryBuilder

Defining Custom Query Records

Transactions In PikaORM

Migrations

Using PikaORM with a Web Framework

About

Pika ORM for Java

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages