Skip to content

Second Tutorial Part 1: Compile Time Java Code Generation

Laurent Hasson edited this page Oct 2, 2019 · 16 revisions
Previous Main Next
Main Part 2 -->

This Tutorial

In the First Tutorial, we explored the modeling capabilities of Tilda and the ability to iteratively define tables and complex views. For some projects, this may be all you need to do: maintain a rich schema, produce documentation, enjoy automated iterative deployments with automated migrations. This is a simple way to use Tilda with at the core simple managed SQL-based assets (DDL files). This is applicable for example for data warehouse projects or schemas in general where data population and access is done via tools (for example, an ETL suite such as Pentaho Kettle to populate the database and a reporting tool such as Tableau to display data).

For some other projects however, you may want to access the data through an application, for example, a Java-based Web application. In that respect, Tilda is similar to other frameworks such as Hibernate or MyBatis, but with some key differences:

  • Tilda is model-driven from the start as illustrated by the First Tutorial.
  • Tilda generates transparent Java-based assets that do not obfuscate your model or your SQL needs.
  • Tilda can reverse engineer schemas and generate models, which in turn will be used to stand up Java applications.
  • Tilda generates all your POJOs and JDBC wrapper code from the model: no need to write tedious access code to stand up an application against a model.
  • Documentation and migration are built in from the start.
  • Tilda understands JSON or CSV and patterns such as "sync" and thus is a perfect solution for web services that manage sync'ed data sets from mobile or offline applications.
  • Tilda generates compile-time artifacts which makes iterative development and model refactoring a natural part of the development process, aided with standard features of your favorite IDE and compiler.

In this tutorial, we'll cover the basic architecture of the Java code Tilda generates and how to use them, in particular:

  • Reading and writing from tables
  • Reading from views
  • Methods of access via indices and queries
  • Custom where-clauses
  • Record Processors
  • Servlet bindings
  • Data export capabilities in JSON and CSV
  • Custom queries
  • Code customization with hidden fields and pre-write/post-read handlers.

We expect someone to take about 60mn to get through this 10-parts material, and an accompanying video that shows an actual development session. The parts are:

Clone this wiki locally