Developer(s) Mladen Adamovic Written in Java Platform Java | Development status Active Operating system | |
Stable release 1.0.2 / March 16, 2015 (2015-03-16) |
Fjorm is a free open source software library for fast but simple mapping of POJOs to the database. Fjorm got its name as acronym from Fast Java Object Relationship software. It targets to have less than 10% performance overhead over plain JDBC. Fjorm is designed and developed by former Google software engineer.
Contents
Paradigm
Some performance testing of most popular Java ORM, Hibernate, are showing large performance drawbacks for using Hibernate.
Fjorm aims to be fast and lightweight approach. It does not support mapping of m:n relationships neither n:1 relationships due to possible performance issues. It doesn't create new query language, it uses SQL which whom most database developers are fluent and which is quite powerful and standardized. It assumes database fields will be represented as public fields in Java code and that developers shall use same name for the field as in the database. It uses Java reflection over those fields to enable to perform CRUD operations.
Example
Let us assume that we have the following MySQL database for books:
These tables are mapped in Fjorm as follows, table 'language':
Mapping of table 'author':
Mapping of table 'book':
Example of creating new languages in the database:
Example of updating author, setting that author as distinguished:
Get authors which have book published in 2009:
Get all books from authors born after 1980:
Example of performing delete commands from interface to our database
Examaple of selecting from a database