JPA, HTML, and MySQL Code Generation in One Minute

DZone 's Guide to

JPA, HTML, and MySQL Code Generation in One Minute

We look at a tool that can help create source code quickly, allowing developers to concentrate on the creative parts of their applications.

· Web Dev Zone ·
Free Resource

With the current trends in the software development field, agility and faster delivery of software applications have become an important part of the IT industry. In fact, this has been one of the main reasons for the evolution of many of the modern technologies and trends, such as single page applications, lightweight frameworks, and microservices architecture. However, even with the massive improvements in the technologies, IDEs, and tools, developers still write a lot of code to get the job done. To achieve the goals of increasing software developers productivity and to reduce the cost of software development, the Clowiz platform has been created.

Clowizis a cloud-based platform that enables developers to generate software artifacts (using CodeGen), end-to-end features (using FeatureGen), and full end-to-end apps (using AppGen) without writing a single line of code. 

In this article, we are going to createa  Java JPA Entity, a Full HTML page, and a MySQL create table statement in less than 5 minutes, without writing code using Clowiz CodeGen.

Clowiz CodeGen Tutorial

In this tutorial, we are going to generate the following artifacts without writing code:

  • Java JPA/Hibernate entity with Lombok.
  • Full HTML Page.
  • MySQL Create Table.

Tip: Lombok is a compilation processor that generates setters and getters for Java classes at compile time.

Java JPA/Hibernate Entity

The following steps will generate a full JPA entity with Lombok support:

  • Navigate to CodeGen app at https://www.clowiz.com/code-generator/.
  • In the Metadata section on the left side, create/modify the following metadata:
    • change the Class Name value to Employee.
    • Add a new field with name Number and data type Integer.
    • Add a new field with name Name and data type Text.
    • Add a new field with name Email and data type Email.
    • Add a new field with name Salary and data type Double.
  • Choose JPA with Lombok exporter from the Exporters' section

The components of CodeGen is shown in the following Figure.

Image titleAfter following the above steps, the exporter will generate the following Java source code:

package com.app.models;

import lombok.Data;
import javax.persistence.*;
public class Employee{

@GeneratedValue(strategy = GenerationType.IDENTITY)
Integer id;

@Column(name="number" )
Integer number;

@Column(name="name" )
String name;

@Column(name="email" )
String email;

@Column(name="salary" )
Double salary;


HTML Full Page With Bootstrap

If you have already followed the steps in previous section, all that you need to do is just select the exporter by:

  • Selecting HTML from the technologies section.
  • Selecting the HTML Full Page with Bootstrap Exporter.

After following the above steps, the exporter will generate the following HTML source code:

<!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>Clowiz Page</title>

    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://stackpath.bootstrapcdn.com/bootswatch/4.1.3/simplex/bootstrap.min.css" rel="stylesheet">
    <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">

     <form method="post" action="" id="frmEmployee"/>
        <div class="Employee  card" style="width:500px; margin:auto;">
        <div class="card-header">null Form</div>
        <div class="card-body">
        <input type="hidden" name="id" />
                <span class="form-group">
                        <label for="number" >number</label>
                        <input type="number" name="number" id="number" class="form-control "/>
                <span class="form-group">
                        <label for="name" >name</label>
                        <input type="text" name="name" id="name" class="form-control "/>
                <span class="form-group">
                        <label for="email" >email</label>
                        <input type="email" name="email" id="email" class="form-control "/>
                <span class="form-group">
                        <label for="salary" >salary</label>
                        <input type="number" name="salary" id="salary" class="form-control "/>
        <div class="card-footer">
                <input type="submit" value="submit" />

    <script src="vendor/jquery/jquery.min.js"></script>
    <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

MySQL Structure Script

If you already followed the steps in the previous section, all that you need is to select the exporter by:

  • Selecting SQL from the technologies section.
  • Selecting the MySQL SQL Structure Exporter.

After following the above steps, the exporter will generate the following SQL source code:

create table `employee`(
`id` integer not null auto_increment,
`number` integer,
`name` varchar(250),
`email` varchar(250),
`salary` double precision,
primary key (id)

Clowiz CodeGen currently supports more than 15 technologies and frameworks, such as SpringBoot, Angular, and React, with many more coming very soon. 

Disclaimer: I am the founder of Clowiz platform. Please let me know if you feel that I should consider other technologies or frameworks.

application development, html, java, rapid application development, sql, web dev

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}