What is Velosurf?

Velosurf is a java database mapping layer for Apache Velocity.

Velosurf provides an 'out-of-the-box' automatized mapping of database tables and fields, along with the ability to easily define custom entities, queries and actions in SQL. It is a lightweight placeholder to persistence systems.

Velosurf main features are:

  • easy template grammar
  • code isolation: SQL queries are gathered in one place and appear as standard objects properties
  • dynamic mapping: no need to recompile on any database change
  • automatic connection recovery, statements and connections pooling
  • reverse engeenering of database schema
  • natural type mapping
  • transactions
  • default Java mapping objects that you can override when needed
  • basic tools to include authentication, internationalization and data validation in your app

Velosurf can be used as a standard Velocity tool (and as such easily integrated in every Web framework that supports the Velocity Tools rendering layer), as well as a generic java database abstraction layer.

Why Velosurf?

The main goal of Velosurf is to spare template writers the pain of rewriting specific database mapping layers in Java for each project involving Velocity and database entities. It is also meant to have a clean separation between SQL, Java and VTL.

Persistence layers are hard to design and maintain, and have been made obsolete by database caching technology. So why not have a thin and generic mapping engine that will fetch values directly from the database when you need them? With Velosurf, object properties can represent not just column values, but also complex queries, something difficult to do with a persistence framework.

Last but not least: developers often try to protect users from many concepts that may appear too complex or too weird to them. But even if a data model is complex, its complexity has nothing or little to do with technical constraints, and everything to do with logic and modeling. The spirit of Velosurf is that those constraints should be shared and exposed to all people involved in a project - like designers - who should be as competent as developers are (who said "more"?) to deal with business logic.

In a nutshell, Velosurf allows developers to expose a data model where properties are table fields or SQL queries and designers to easily traverse this data model by means of the '.' dereferencement operator (e.g. "book.publisher.address").