article

valhuber avatar image
0 Likes"
valhuber posted

ORM?and More?is Automatic With Espresso Logic

A recent DZone article argues that There is No Such Thing as Object Relational Impedance Mismatch.   The author, Lukas Eder, observes that with bi-directional accessors for foreign keys and multi-set data, you get the key benefits of an ORM.

We agree, so we made ORM automatic:

  • Instant RESTful Web Service creation
  • With rich ORM and event model for logic
    • Including support for databases without foreign keys
  • And declarative business rules
  • And row / column level security
  • Oh, and by the way, a free Web App

Here?s how it works.

Installation

Install a war file into a container (Cloud or on-premise), and you are up.  Use the Browser-based Designer to define your API, its logic and its security (shown below).

Connect for Instant RESTful Web Services

Create a API by connecting to your database:

Screen Shot 2015-09-04 at 10.52.31 AM

Your API is instantly operational, shown here in a convenient testing tool:

default api

Web Services vs. Language-Specific

There is an important distinction between ORMs and Web Services.  ORMs are language-specific: Hibernate / JPA for Java, Entity Framework for .Net, and so forth.  They are also method calls.

Web Services, by contrast, are:

  • Language-neutral: results in JSON or XML can be parsed by any language, and moved to objects.  Tools like Swagger can generate the target objects (Java POJOs, .Net POCOs, etc).
  • Message-oriented: Web Services provide coarse-grained, network-based access.  This is perfect for modern applications, such as mobile devices (detached from the server), or systems integration.  And this leads directly to a big feature: returning multiple row types in a single request, a key requirement for message-based access.

Point and Click Custom Resources, for Nested Document Results

Default Resources are fine, but that?s just a flat relational model.  You can also define Custom Resources that return multiple row type (multi-set) results, even over multiple databases / ERP systems:

Screen Shot 2015-09-04 at 12.45.50 PM

Observe you can shape your API, by naming resources, choosing /aliasing columns.  In this way, your API is what you want, rather than a simple ?restification? of your schema.

Once specified, no compile / deploy.  It?s ready to test, as before:

default api


Automatic Rich ORM and Event Model

The server provides full support for Server-side Java Script, including creation of a complete Java Script Object Model ? directly from the schema.  Part of the model includes Events, as shown below:

events

Note the Object Model provides simple access to attributes, and persistence (read/write).  It also automates bi-directional navigation for Foreign Keys:

row.Customer.creditLimit
row.LineItems

Support for Databases without Foreign Keys

In actual practice, many databases are created without Foreign Keys.  The system enables you to define these, including relationships between different databases.  Specify them as follows in the Designer:

resources

 

Declarative Business Rules

A useful API must enforce your business policy.  Coding these with events is possible, but involves substantial cookie-cutter code for Change Detection / Change Propagation.  Eliminate cookie-cutter code with rules:

rules

Rules have key characteristics that distinguish them from procedural code:

  • Automatic Invocation - the system executes the rules whenever their dependent data changes.  This ensures quality ? the rules are always run
  • Automatic Ordering - rule execution order is based on system-discovered dependencies
  • Automatic Persistence ? the rules above are complete, and optimized.  For example, changing an orders? paid flag results in a one row adjustment update (not an aggregate query), only when the dependent PurchaseOrder data is changed

The result is remarkable: the 5 rules above are 40X more concise than conventional procedural logic.

Row Level Security

An API must not only enforce integrity, it must enforce security.  Otherwise, such logic becomes embedded in client apps, increasing work and making the logic difficult to re-use for other applications (e.g., systems integration).  So, a declarative approach is provided:

security

And a Free Web App

You also get a complete web app ? right from your schema ? without any programming or HTML.  This Web App is appropriate for Back Office Data Maintenance, a perfect complement to your custom apps built on the same API.

It uses the RESTful API, so logic, security and integration are provided.  And you can customize the layout, style sheet and much more.

arrows-on-screen-shots-home-page-600

 

Summary: Business Logic Server

So, we came for an ORM.  We got it for free, and a lot more: a complete RESTful server that integrates multiple databases, enforces our logic and security, and even a basic Web App.  And we got it fast ? orders of magnitude faster than low level manual coding.

orm
10 |600

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Article

Contributors

valhuber contributed to this article

Related Articles