Wednesday, 2 November 2022

Hibernate 6: postgresql hello world application

Step 1: Create new maven project ‘hibernate-postgres-hello-world’.

 

Step 2: Update pom.xml with maven dependencies.

 

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.sample.app</groupId>
    <artifactId>hibernate-postgres-hello-world</artifactId>
    <version>1</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <java.version>15</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>

    </properties>

    <dependencies>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.4.1</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>6.1.2.Final</version>
        </dependency>

        <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>javax.persistence-api</artifactId>
            <version>2.2</version>
        </dependency>


    </dependencies>
</project>

 

Step 3: Define Employee class.

 

Employee.java
package com.sample.app.entity;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

@Entity
@Table(name = "employees")
public class Employee {
    @Id
    private int id;
    private String firstName;
    private String lastName;
    private String designation;
    private int age;

    public Employee() {
    }

    public Employee(int id, String firstName, String lastName, String designation, int age) {
        super();
        this.id = id;
        this.firstName = firstName;
        this.lastName = lastName;
        this.designation = designation;
        this.age = age;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getDesignation() {
        return designation;
    }

    public void setDesignation(String designation) {
        this.designation = designation;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

}

 

Entity class specifies that the class is an entity. Entity class follow java bean conventions.

a.   @jakarta.persistence.Entity annotation is used to mark a class as an entity.

b.   @jakarta.persistence.Table annotation explicitly specifies the table name

c.    @jakarta.persistence.Id marks the property which defines the entity’s identifier.

 

 

Step 4: Create hibernate.cfg.xml file under src/main/resources folder.

hibernate.cfg.xml

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>

    <session-factory>

        <!-- Database Connection settings -->
        <property name="connection.driver_class">org.postgresql.Driver</property>
        <property name="connection.url">jdbc:postgresql://127.0.0.1:5432/test</property>
        <property name="connection.username">postgres</property>
        <property name="connection.password">postgres</property>

        <!-- Enable the logging of all the generated SQL statements to the console -->
        <property name="show_sql">true</property>

        <!-- Format the generated SQL statement to make it more readable, -->
        <property name="format_sql">true</property>

        <!-- Hibernate will put comments inside all generated SQL statements to 
            hint what’s the generated SQL trying to do -->
        <property name="use_sql_comments">false</property>

        <!-- This property makes Hibernate generate the appropriate SQL for the 
            chosen database. -->
        <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>

        <!-- Drop and re-create the database schema on startup -->
        <property name="hbm2ddl.auto">create</property>

        <!-- mappings for annotated classes -->
        <mapping class="com.sample.app.entity.Employee" />

    </session-factory>

</hibernate-configuration>

 

hibernate.cfg.xml file defines the Hibernate configuration information.

a.   The connection.driver_class, connection.url, connection.username and connection.password  property elements define JDBC connection information. All the tutorials use Postgres database, so the values of these properties are all specific to running Postgres in your computer.

b.   The dialect property specifies the particular SQL variant (org.hibernate.dialect.PostgreSQLDialect) with which Hibernate will work with.

c.    The hbm2ddl.auto property enables automatic generation of database schemas like tables.

d.   <mapping> element add persistent classes to the configuration.

 

Step 5: Define HelloWorld class.

 

HelloWorld.java

 

package com.sample.app;

import java.io.IOException;
import java.net.URISyntaxException;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;

import com.sample.app.entity.Employee;

public class HelloWorld {
    private static SessionFactory sessionFactory = buildSessionFactory();

    private static SessionFactory buildSessionFactory() {
        try {
            if (sessionFactory == null) {
                StandardServiceRegistry standardRegistry = new StandardServiceRegistryBuilder()
                        .configure("hibernate.cfg.xml").build();

                Metadata metaData = new MetadataSources(standardRegistry).getMetadataBuilder().build();

                sessionFactory = metaData.getSessionFactoryBuilder().build();
            }
            return sessionFactory;
        } catch (Throwable ex) {
            throw new ExceptionInInitializerError(ex);
        }
    }

    public static void main(String args[]) throws ClassNotFoundException, IOException, URISyntaxException {
        Employee emp1 = new Employee(1, "Krishna", "G", "Senior Software Developer", 26);
        Employee emp2 = new Employee(2, "Shreyas", "Desai", "Team Manager", 35);
        Employee emp3 = new Employee(3, "Piyush", "Rai", "Senior Software Developer", 26);
        Employee emp4 = new Employee(4, "Maruti", "Borker", "Software Developer", 26);

        Session session = sessionFactory.openSession();
        session.beginTransaction();
        session.persist(emp1);
        session.persist(emp2);
        session.persist(emp3);
        session.persist(emp4);
        session.getTransaction().commit();
        session.close();
    }
}

 

SessionFactory: It is a factory for org.hibernate.Session instances. Since creation of SessionFactory instance is a costly operation, Application should have only one instance of SessionFactory for a given database. SessionFactory maintain a secondary cache across all the session maintained by this.

 

Session: session represents the main runtime interface between a Java application and Hibernate. It is a single-threaded, short-lived object conceptually modeling a "Unit of Work". The primary purpose of the Session is to offer create, read, and delete operations for instances of mapped entity classes.

 

 

Total project structure looks like below.


 

Run HelloWorld application. You will see below messages in the console.

Aug 08, 2022 4:27:18 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate ORM core version 6.1.2.Final
Aug 08, 2022 4:27:18 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using built-in connection pool (not intended for production use)
Aug 08, 2022 4:27:18 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: Loaded JDBC driver class: org.postgresql.Driver
Aug 08, 2022 4:27:18 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001012: Connecting with JDBC URL [jdbc:postgresql://127.0.0.1:5432/test]
Aug 08, 2022 4:27:18 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {password=****, user=postgres}
Aug 08, 2022 4:27:18 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
Aug 08, 2022 4:27:18 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections <init>
INFO: HHH10001115: Connection pool size: 20 (min=1)
Aug 08, 2022 4:27:19 PM org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl logSelectedDialect
INFO: HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
Hibernate: 
    
    drop table if exists employees cascade
Aug 08, 2022 4:27:19 PM org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@41dc0598] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.
Aug 08, 2022 4:27:19 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper$StandardWarningHandler logWarning
WARN: SQL Warning Code: 0, SQLState: 00000
Aug 08, 2022 4:27:19 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper$StandardWarningHandler logWarning
WARN: table "employees" does not exist, skipping
Hibernate: 
    
    create table employees (
       id integer not null,
        age integer not null,
        designation varchar(255),
        firstName varchar(255),
        lastName varchar(255),
        primary key (id)
    )
Aug 08, 2022 4:27:19 PM org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@3e4e4c1] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.
Aug 08, 2022 4:27:19 PM org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformInitiator initiateService
INFO: HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
Hibernate: 
    insert 
    into
        employees
        (age, designation, firstName, lastName, id) 
    values
        (?, ?, ?, ?, ?)
Hibernate: 
    insert 
    into
        employees
        (age, designation, firstName, lastName, id) 
    values
        (?, ?, ?, ?, ?)
Hibernate: 
    insert 
    into
        employees
        (age, designation, firstName, lastName, id) 
    values
        (?, ?, ?, ?, ?)
Hibernate: 
    insert 
    into
        employees
        (age, designation, firstName, lastName, id) 
    values
        (?, ?, ?, ?, ?)

 

Login to postgresql test database and query employees table to confirm the same.

test=# select * from employees;
 id | age |        designation        | firstname | lastname 
----+-----+---------------------------+-----------+----------
  1 |  26 | Senior Software Developer | Krishna   | G
  2 |  35 | Team Manager              | Shreyas   | Desai
  3 |  26 | Senior Software Developer | Piyush    | Rai
  4 |  26 | Software Developer        | Maruti    | Borker 

 

You can download complete working application from this link.



Previous                                                    Next                                                    Home

Tuesday, 1 November 2022

Design error message for HTTP APIs using RFC 7807

 

In this post, I am going to talk about the RFC 7807, which documents the standard http error message structure.

 

If you are working with webservices, then you might have seen http error codes like below.

a.   400 (Bad Request)

b.   401 (Unauthorized)

c.    403 (Forbidden)

d.   404 (Not found)

e.   500 (Internal Server error)

f.     503 (Service unavailable)

g.   504 (Gateway timeout) etc.,

 

But sometimes, these http status codes alone not sufficient to convey the details about the error. To address this problem, we need a standardized error structure, that can be uniformly accepted by the applications and provide meaningful insights about the error. Here RFC 7807 comes into picture.

 

As per RFC 7807, error or problem details object has the following members.

 

Member

Data type

description

type

String

URI references that identifies the problem type.

title

String

A short, human-readable summary of the problem type. ‘title’ help the users who are not aware of semantics of URI and do not have the ability to discover them

status

number

Http Status code

detail

String

A human-readable explanation specific to this occurrence of the problem.

instance

String

A URI reference that identifies the specific occurrence of the problem.  It may or may not yield further information if dereferenced.

 

Example 


{
  "type": "https://demo.com/probs/insuffecient-funds",
  "title": "You do not have enough funds in the linked accounts.",
  "detail": "Your current balance is 2500, but that costs 7500.",
  "instance": "https://demo.net/account/12345/msgs/abc",
  "status" : 403
}

 

Apart from the standard members, you can add additional members to the error object to convey more details.

{
  "type": "https://demo.com/probs/insuffecient-funds",
  "title": "You do not have enough funds in the linked accounts.",
  "detail": "Your current balance is 2500, but that costs 7500.",
  "instance": "https://demo.net/account/12345/msgs/abc",
  "status" : 403
  "balance": 7500,
  "linked_accounts": [
    "https://example.net/account/12345",
    "https://example.net/account/67890"
  ]
}

 

Note

a.   Both "type" and "instance" accept relative URIs; this means that they must be resolved relative to the document's base URI

 

References

https://www.rfc-editor.org/rfc/rfc7807

 

 

Previous                                                 Next                                                 Home

Hibernate 6: H2 Hello world application

Follow below step-by-step procedure to connect to H2 database using Hibernate.

 

Step 1: Create new maven project ‘hibernate-h2-hello-world’.

 

Step 2: Update pom.xml with maven dependencies.

 

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.sample.app</groupId>
    <artifactId>hibernate-h2-hello-world</artifactId>
    <version>1</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <java.version>15</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>

    </properties>

    <dependencies>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>2.1.214</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>6.1.2.Final</version>
        </dependency>

        <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>javax.persistence-api</artifactId>
            <version>2.2</version>
        </dependency>


    </dependencies>
</project>

 

Step 3: Define Employee entity class.

 

Employee.java
package com.sample.app.entity;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

@Entity
@Table(name = "employees")
public class Employee {
    @Id
    private int id;
    private String firstName;
    private String lastName;
    private String designation;
    private int age;

    public Employee() {
    }

    public Employee(int id, String firstName, String lastName, String designation, int age) {
        super();
        this.id = id;
        this.firstName = firstName;
        this.lastName = lastName;
        this.designation = designation;
        this.age = age;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getDesignation() {
        return designation;
    }

    public void setDesignation(String designation) {
        this.designation = designation;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Employee [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", designation="
                + designation + ", age=" + age + "]";
    }

}

 

Step 4: Create hibernate.cfg.xml file under src/main/resources folder.

 

hibernate.cfg.xml

 

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>

    <session-factory>
        <!-- JDBC Database connection settings -->
        <property name="connection.driver_class">org.h2.Driver</property>
        <property name="connection.url">jdbc:h2:mem:test</property>
        <property name="connection.username">admin</property>
        <property name="connection.password">admin</property>
        <property name="connection.pool_size">1</property>

        <property name="dialect">org.hibernate.dialect.H2Dialect</property>
        <!-- Echo the SQL to stdout -->
        <property name="show_sql">true</property>
        <property name="format_sql">true</property>
        <property name="current_session_context_class">thread</property>
        <!-- Drop and re-create the database schema on startup -->
        <property name="hbm2ddl.auto">create-drop</property>
        
        <!-- dbcp connection pool configuration -->
        <property name="hibernate.dbcp.initialSize">2</property>
        <property name="hibernate.dbcp.maxTotal">10</property>
        <property name="hibernate.dbcp.maxIdle">5</property>
        <property name="hibernate.dbcp.minIdle">3</property>
        <property name="hibernate.dbcp.maxWaitMillis">-1</property>

        <!-- mappings for annotated classes -->
        <mapping class="com.sample.app.entity.Employee" />

    </session-factory>

</hibernate-configuration>

 

Step 5: Define main application class.

 

App.java

package com.sample.app;

import java.io.IOException;
import java.net.URISyntaxException;
import java.util.List;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;

import com.sample.app.entity.Employee;

import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.CriteriaQuery;

public class App {
    private static SessionFactory sessionFactory = buildSessionFactory();

    private static <T> List<T> loadAllData(Class<T> clazz, Session session) {
        final CriteriaBuilder builder = session.getCriteriaBuilder();
        final CriteriaQuery<T> criteria = builder.createQuery(clazz);
        criteria.from(clazz);
        return session.createQuery(criteria).getResultList();
    }

    private static SessionFactory buildSessionFactory() {
        try {
            if (sessionFactory == null) {
                StandardServiceRegistry standardRegistry = new StandardServiceRegistryBuilder()
                        .configure("hibernate.cfg.xml").build();

                Metadata metaData = new MetadataSources(standardRegistry).getMetadataBuilder().build();

                sessionFactory = metaData.getSessionFactoryBuilder().build();
            }
            return sessionFactory;
        } catch (Throwable ex) {
            throw new ExceptionInInitializerError(ex);
        }
    }

    public static void main(String args[]) throws ClassNotFoundException, IOException, URISyntaxException {
        Employee emp1 = new Employee(1, "Krishna", "G", "Senior Software Developer", 26);
        Employee emp2 = new Employee(2, "Shreyas", "Desai", "Team Manager", 35);
        Employee emp3 = new Employee(3, "Piyush", "Rai", "Senior Software Developer", 26);
        Employee emp4 = new Employee(4, "Maruti", "Borker", "Software Developer", 26);

        try (Session session = sessionFactory.openSession()) {
            session.beginTransaction();
            session.persist(emp1);
            session.persist(emp2);
            session.persist(emp3);
            session.persist(emp4);

            List<Employee> emps = loadAllData(Employee.class, session);
            for (Employee emp : emps) {
                System.out.println(emp);
            }

            session.getTransaction().commit();
        }

    }
}

 

Total project structure looks like below.

 


Run App.java, you will see below messages in the console.

Aug 17, 2022 7:57:46 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate ORM core version 6.1.2.Final
Aug 17, 2022 7:57:46 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using built-in connection pool (not intended for production use)
Aug 17, 2022 7:57:46 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: Loaded JDBC driver class: org.h2.Driver
Aug 17, 2022 7:57:46 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001012: Connecting with JDBC URL [jdbc:h2:mem:test]
Aug 17, 2022 7:57:46 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {password=****, user=admin}
Aug 17, 2022 7:57:46 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
Aug 17, 2022 7:57:46 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections <init>
INFO: HHH10001115: Connection pool size: 1 (min=1)
Aug 17, 2022 7:57:46 PM org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl logSelectedDialect
INFO: HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
Hibernate: 
    
    drop table if exists employees cascade 
Aug 17, 2022 7:57:47 PM org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@3e5fd2b1] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.
Hibernate: 
    
    create table employees (
       id integer not null,
        age integer not null,
        designation varchar(255),
        firstName varchar(255),
        lastName varchar(255),
        primary key (id)
    )
Aug 17, 2022 7:57:47 PM org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@23a918c7] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.
Hibernate: 
    insert 
    into
        employees
        (age, designation, firstName, lastName, id) 
    values
        (?, ?, ?, ?, ?)
Hibernate: 
    insert 
    into
        employees
        (age, designation, firstName, lastName, id) 
    values
        (?, ?, ?, ?, ?)
Hibernate: 
    insert 
    into
        employees
        (age, designation, firstName, lastName, id) 
    values
        (?, ?, ?, ?, ?)
Hibernate: 
    insert 
    into
        employees
        (age, designation, firstName, lastName, id) 
    values
        (?, ?, ?, ?, ?)
Hibernate: 
    select
        e1_0.id,
        e1_0.age,
        e1_0.designation,
        e1_0.firstName,
        e1_0.lastName 
    from
        employees e1_0
Employee [id=1, firstName=Krishna, lastName=G, designation=Senior Software Developer, age=26]
Employee [id=2, firstName=Shreyas, lastName=Desai, designation=Team Manager, age=35]
Employee [id=3, firstName=Piyush, lastName=Rai, designation=Senior Software Developer, age=26]
Employee [id=4, firstName=Maruti, lastName=Borker, designation=Software Developer, age=26]

You can download complete working application from this link.




 

 

 

  

Previous                                                    Next                                                    Home