MaiPenRai - Java Object and Relation Persistence framework.

"Mai Pen Rai" is Thai for "no problem", which pretty much sums up this framework! Why should Java Object and Relation Persistence require so much work?

MaiPenRai is a fully automated framework. All you have to do is to provide the database connection url and SQL dialect. Then you simply let your Java domain objects inherit from a class provided by the framework. Then you're done. You may store, retrieve, delete or search for your objects. There are no mapping configuration files. No SQL is required, tables and rows are created or updated on demand.

Despite this, there is no magic involved, the mapping is quite easy to understand. Tables are named after the corresponding classes. Columns are named after corresponding fields. Each object is given a unique id, identifying the class and object instance. This id is used for mapping object relations and runtime resolving the actual class an object refers to, thus fully supporting inheritence as well.

You still have the option to write specialized SQL statements or stored procedures towards the generated tables. In short, the framework doesn't inhibit you in any way, it just takes care of all that mundane mapping in the easiest possible way.

Another key feature, that is not yet fully implemented, is refactoring support! One of the major real-life problems with object / relational mapping is that the two models tend to migrate in different directions over time. With this framework that is not possible, the models are simple too tightly coupled. So a central feature of the framework will be to provide a mechanism for refactoring of the database. See the roadmap for details about when to expect this feature.

Implemented Features

  • Fully automated mapping from Java Objects and their Relations to SQL statements.
    • No configuration files needed.
    • Prepared statements are used to avoid problems with SQL injection.
    • Tables and rows are created on demand.
  • Store, retrieve, delete and search:
    • of all primitive Java types, including String and Date.
    • of arrays of any dimension.
    • of object relations / associations
      • inheritence is fully supported and resolved at runtime.
      • deep or shallow operation, i.e. perform operation on this objects only, or on this object and all related objects at the same time.
      • circular references are resolved.
  • Database support, currently only two databases have been tested:
  • Non-default class or field mapping support:
    • Fields may be indexed.
    • Names may be overridden. Use sparingly! It's provided just in case you have selected a a field / class name that is an SQL keyword, or if two classes have the same name but are located in different packages (which in itself is not recommended).
    • SQL types may be overridden. Use sparingly! It might make porting to another database more difficult.
  • SQL prepared statement execution. An interface for executing custom SQL statements is included, saving you from the time required to work with JDBC, connection pooling, etc.

See the roadmap page for details about planned features.

Requirements

  • Java 1.5 or later is required. It may be possible to rewrite the framework for earlier versions of Java, but this author does not intend to do so.
  • One of the supported databases. See feature list above.

Contribute

Do you like what you see so far? But the framework lacks that one killer feature that you've always wanted? Or perhaps doesn't support your favourite database? Get involved! Contact the author (see mail address below).

In particular, I'm looking for people

  • who can help with creating support for new databases, either simply testing or coding.
  • who are more artisticly inclined than the author, creating a professional looking logo and stylesheet / colour scheme for the website.

Feedback

Send questions, comments, suggestions for improvements to Steinar Haugen, stenis999@users.sourceforge.net.