Your First Rest Project

Version 7.1 by Pascal Robert on 2011/12/27 10:23

Introduction

In the first part of the Blog tutorial, you will learn:

  • How to create a EOModel for the database (we will use H2)
  • How to use migrations to create the database tables
  • How to use ERRest to create blog posts with JSON format and how to display the blog posts in HTML for readers

Create the database model

We will build a small database model for the blog. The database will have two tables: BlogEntry and Author.

BlogEntry will have the following columns:

Column nameTypeConstraints
idintegerprimary key
titlestring(255) 
contentstring(4000) 
lastModifiedtimestamp 
creationDatetimestamp 
authorintegerrelation with Author

Author will have the following columns:

Column nameTypeConstraints
idintegerprimary key
firstNamestring(100) 
lastNamestring(100) 
emailstring(150)unique
passwdstring(16 

To create the database, we will first create a EOModel and use migrations to build the database on the file system (H2 will take care of creating the database file).