Are you looking for an easy to use, quick object-relation mapping solution with a small footprint? The Ujorm framework has a type-safe API for queries so the most of typing errors are detected before running the application. Developer can take an advantage of a code-completion in their favorite IDE at coding time. Try it!

 

architecture

Why a new ORM mapping?

Simplified Class Model of The Ujorm The Ujorm is designed primarily for the rapid Java development based on a relation database.
  • java compiler can discover a syntax error of Ujorm database query similar like 4GL database languages
  • easy to configure the ORM model by java source code, optionally by annotations and a XML file
  • great performance, some types of SELECT query are very fast in comparison to its competitors
  • never more a LazyInitialization exception though a lazy initialization is supported
  • no confusing proxy business objects
  • result of a database query is a special object called UjoIterator. with useful methods toList() or count() for example
  • very lightweight framework with no more library dependencies

architecture

Some other features

  • incremental database update by meta-model using DDL statements
  • database indexes are created by the meta-model, added support for unique, non-unique indexes including the composed one
  • resources for ORM mapping can be a database table, view or native SQL SELECT
  • JDBC query parameters are passed by a 'question mark' notation to the PreparedStatement for a high security
  • LIMIT and OFFSET are supported
  • stored database procedures and functions are supported
  • all persistent objects are based on the interface OrmUjo, namely on the implementation OrmTable
  • internal object cache is based on the WeakHashMap class so that large transactions does not cause any OutOfMemoryException
  • some parts of the API was inspired by Canyenne and Hibernate frameworks. I would like to thank the authors for great work.

architecture

Sample of usage:

See how to create database and to how to INSERT an order with two items into database:
  OrmHandler.getInstance().loadDatabase(Database.class);

  Order order = new Order();
  order.setDate(new Date());
  order.setDescr("John's order");

  Item item1 = new Item();
  item1.setOrder(order);
  item1.setDescr("Yellow table");

  Item item2 = new Item();
  item2.setOrder(order);
  item2.setDescr("Green window");

  Session session = OrmHandler.getInstance()
                    .createSession();
  session.save(order);
  session.save(item1);
  session.save(item2);

  session.commit();
  session.close();
The next source code calls a SELECT by the UJO Criterion:

  Criterion<Item> cn1, cn2, criterion;

  cn1 = Criterion.where( Item.ID, Operator.GE, 1L );
  cn2 = Criterion.where( Item.ORDER.add(Order.DESCR)
                       , "John's order" ); // Equals to
  criterion = cn1.and(cn2);

  Session session = OrmHandler.getInstance()
                    .createSession();
  Query<Item> items = session.createQuery(criterion);
  System.out.println( "Row count: " + items.getCount());

  for (Item item : items) {
      String descr = item.getDescr();
      Date created = item.getOrder().getDate();
      System.out.println( created + " : " + descr );
  }
  session.close();
And how to get meta-data for a 'description' property of the Order?
  OrmHandler hr = OrmHandler.getInstance();

  MetaColumn col = (MetaColumn)
             hr.findColumnModel(Order.DESCR);

  StringBuilder msg = new StringBuilder()
      .append("Length : " + col.getMaxLength() + '\n')
      .append("NotNull: " + col.isMandatory()  + '\n')
      .append("PrimKey: " + col.isPrimaryKey() + '\n')
      .append("DB name: " + col.getFullName()  + '\n')
      ;

  System.out.println(msg);
  

architecture

Similar frameworks:

There are some links to similar open-source frameworks with a type-safe queries:
  • SimpleORM - object relational mapping system that avoids exotic technologies such as byte code generation, where queries can be specified in terms of Java objects, object identity is aligned with database keys.
  • Empire-db - relational data persistence component which allows database vendor independent dynamic query definition with a special focus on compile-time safety, reduced redundancies and improved developer productivity.
  • Querydsl - a framework which enables the construction of statically typed SQL-like queries

 

support

Support: