• +381641430769
  • This email address is being protected from spambots. You need JavaScript enabled to view it.

Create PetClinic

without writing a single line of code in less than an hour

Image

The Spring PetClinic is a sample application designed to show how the Spring stack can be used to build simple, but powerful database-oriented applications. The Spring PetClinic was created in 2003 by Kren Krebs and Juergen Hoeller who are developing the first version of the Spring Framework. Today many implementations are created in various technologies and languages like: Angular, Kotlin, React etc.

You can read the full story here: https://spring-petclinic.github.io/
Spring official demo: https://spring-petclinic-community.herokuapp.com/

Pet Clinic is a good example of a simple but complete application where technology or framework can demonstrate what is possible to conceive with it.

In this tutorial we will demonstrate how you can create Pet Clinic without writing a single line of code in less than an hour. You can compare the end result with the official version. Note that it is not 1-1 copy of the official version, it's an application that gives you the same (actually much more) functionalities as the original one.

   

Pet Clinic Tutorial

How to build complete Pet Clinic application in 10 steps without coding in less than an hour
Total viewing time: 30' 

PetClinic step1

   

Create PetClinic Model

 

 

Model description:

There are seven tables in the model. The main entities are Pet, Owner, Vet and Visit.

Additional entities are Speciality, VetSpecialty and PetType. VetSpecialty is the associative class between Vet and Speciality entity.

According to the model, we can see that:

  • Each Pet is of particular PetType.

  • One Owner can have more Pets.

  • Pet has to belong to one Owner.

  • Pet has mode Visits.

  • VetSpeciatlty represents Specialities of Vet.

 

pc 1

In Step 1 we will create a PetClinic model with two entities: PetType and Speciality.

After saving a model, all necessary files will be generated automatically:

  • Java project “model-petclinic-jpa” that is a Maven project with:

    • package com.codeless

    • two JPA classes: PetType.java and Speciality.java

    • HibernateConfigurator java

  • application.context is updated

  • the project added as a dependency in CodelessPlatform’s pom.xml

  • project is added to a master pom.xml that is in your workspace root.

After the model is created and changes are saved, we will update our development database. DDL script is generated automatically.

Watch Step 1   (4' 17'')
Notes:

  • As seen in the video, after creating a model, you should import it in your favorite IDE in this case Eclipse IDE.

  • After any change in the model, you should rebuild changed model projects.

PetClinic step1

   

Adding entities: Vet and Owner

 

 

In this step we will add two more entities: Vet and Owner. Note how we will create unique constraints for Vet.

Notes:

  • You don’t have to go to Eclipse and rebuild your projects, you can do that after step 3 when we finish with complete model. 
  • You don’t have to synchronize changes with the database after each step, you can do that also after step 3. 

PetClinic step1

   

Create Entities: Pet, Visit and VetSpecialties

 

 

This step will show you how to create relationships. Note that “reverse” relations can be added with a single click, you just need to give it a name you want.

Watch Step 3 (3' 23'')

Notes:

  • Make sure that all changes are synchronized with the database

  • Stop the platform, go to your IDE and rebuild model-petclinic-jpa project. You can do this with maven clean and then maven install or you can simply run the “rebuild” task you created during installation.

  • Make sure that all changes are synchronized with the database

  • Stop the platform, go to your IDE and rebuild model-petclinic-jpa project. You can do this with maven clean and then maven install or you can simply run the “rebuild” task you created during installation.

  • Note that reverse relations were created in entity VetSpecialty. That resulted in two new relations:       
                 M2O relation: vetSpecialties in Pet entity,
                 M2O relation: vetSpecialties in Specialty entity

PetClinic step1

   

Create PetClinic Application

 

 

In Step 4 we will create a PetClinic application. After saving the newly created application, all necessary files will be generated automatically:

  • Java project “PetClinic” is a Maven project with:
    • two Java classes for translation purpose: PetClinicTranslator and PetClinicMessages
    • Project PetClinic is added as a dependency in CodelessPlatform’s pom.xml

Watch Step 4 (1' 27'')

Notes:

  • Import PetClinic maven project in your IDE.
  • Run task “rebuild” and start the platform to continue.
    • PetClinicTranslator is auto generated file and will not change after the first generation.
    • PetClinicMessages is auto generated each time you save a translation for application PetClinic in the Platform.

PetClinic step1

   

Create Simple Forms

 

 

In Step 5 we will create Speciality, PetType and Owner forms.

Watch Step 5 (3' 34'')

Notes:

  • No need to go to your IDE and rebuild any more. You need to do this only if you are adding new application, change the model or add custom controller or business logic code. Creating forms and menus do not produce any code so you do not need to rebuild anything.

PetClinic step1

   

Create Application Menu

 

 

In Step 6 we will create an application menu with items to start forms that we have created so far.

Watch Step 6 (2' 15'')

Notes:

  • You can translate each item if you write {TEXT_TO_TRANSLATE} and then press “Translate”

  • If you do not put brackets around the text, it will be as is, you do not have to translate it.

  • PET CLINIC menu is added to PetClinic application
    • Application PetClinic is added to a user

 

PetClinic step1

   

Adding some data

 

 

In Step 7 we will add some data to forms we have created so far.

Watch Step 7  (3' 04'')

PetClinic step1

   

Create association VetSpecialty

 

 

In step 8 we will show how to create an associative form that will act as a selection form with checkboxes.

Watch Step 8 (2' 42'')

PetClinic step1

   

Create Pet and Visit entities

 

 

In step 9 we will show how to create a Pet that will have Gallery view, Column renderer, owner with an image on lookup etc.

Watch Step 9 (6' 48'')

PetClinic step1

   

Create Checker View

 

 

In step 10 we will create a Checker view for associative class VetSpecialties

Watch Step 10 (2' 23'')

Learn more about developing Applications
in CodeLess Platform

Model Administrator

Model Administrator

This is a powerful yet very easy to use, web tool that is an integral part of the Codeless Platform. With the Model Administrator you are modeling metadata models. Everything you model will be stored in the database as metadata of your model. 

 

Lear more
Form Designer

Form Designer

This is a visual tool for building Codeless Platform web applications. It utilizes drag & drop, wizards, helpers, property configuration windows, HTML and CSS editors and other helpful tools to create fully functional web forms without any coding.

 

Learn more
Database Synchronization

Database Synchronization

This tool will help you to synchronize changes in metamodel with the database state. You are also able to create all tables if the database is empty and to review all updates executed on a particular database. 


Learn more

Bring Ideas into life with CodeLess Platform

Please publish modules in offcanvas position.