restSQL is an open-source, ultra-lightweight data access layer for HTTP clients. restSQL is a persistence framework or engine in the middle tier of a classic three tier architecture: client, application server and database. It may also be embedded in any middle-tier as a Java library.
What it is
- an SQL generator with Java and HTTP APIs
- uses a simple RESTful HTTP API with XML or JSON serialization
- presents flat or hierarchical views of relational database tables
- organizes access through query-able and updatable database views called SQL Resources
- uses declarative authorization
- offers declarative and plugin mechanisms for implementing domain constraints and business logic
- a JEE web application or a Java library
- platform, JEE container and database agnostic
What it is Not
- an HTTP to JDBC/ODBC bridge that tunnels SQL over HTTP
- an Object-Relational Mapping tool (ORM) that maps tables to objects
- a database or a data storage engine
- a sophisticated query or report generator
- an OLAP-style cube or data warehousing engine
Where it could be Used
- basic CRUD (Create-Read-Update-Delete) access to relational databases
- a database abstraction layer
- a lighter-weight alternative to ORM (e.g. ADO or EJB)
- a lighter-weight alternative to WSDL/SOAP
For many apps:
- Conventional ORM is too heavyweight
- We’ve gone overboard with objects
- Oodles of classes, interfaces, deployment descriptors
- OQL - another language to learn
- Conventional ORM is inflexible
- A domain object layer rarely serves multiple apps well
- Entity objects can’t be joined into arbitrary views
- More accidental complexity: code required to join entities
- Conventional Web Services is too heavyweight
- WSDL and SOAP are complicated
- RESTful Web Services and WADL are simpler
The bottom line – 80/20
- restSQL is targeted at the 80% of data access that is basic CRUD
- No more messing around with basic SQL, some complex ORM tool, oodles of Objects and Interfaces, or quirky OQL.
- Developers can spend their efforts on the remaining 20% of the database access, using an approach appropriate to the problem.
- restSQL frees developers to focus on the essential work of software engineering:
- architecture, data modeling, workflow, UI design, business logic, testing and tuning
- and making our stakeholders happy
restSQL is a different kind of middle tier framework. There is no object-relational mapping, no object query language and no beans. It is intentionally not an object-oriented view of the database. It provides an interface based on Representational State Transfer
(REST) principles, which use HTTP's built-in features, rather than abstracting away from them. The framework makes it simple to put a RESTful interface on a database.
The framework is used in two ways: 1) Clients may connect directly to the restSQL engine using the HTTP API, and 2) your Services use a Java API.
Optionally, applications provide Java-based triggers to manage data validation and business logic. restSQL right-sizes five technologies: SQL, XML, JSON, Java and HTTP. SQL is embedded in XML files that define resources, like database views, that may be queried, added to, updated or deleted using HTTP or a Java access API. Data is serialized over XML or JSON. The framework itself is written in Java and deployed as a JAR or WAR on a standard JEE Container.
restSQL enables you to build multiple SQL Resources, queryable and updatable database views that exist on the middle tier and are accessible via Java or HTTP APIs. SQL Resources may be flat views or hierarchical parent-child. The SQL Resource is defined in an XML file. The core of the definition is the query expression, an SQL DML expression.
restSQL – Trim your Middle
Next Step: Architecture