/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.example.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; /** * * @author Tuoi-Cm */ @Entity @Table public class Students { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(nullable = false, length = 100) private String fullName; @Column(nullable = false, length = 100) private int age; // Constructor public Students() { } public Students(Long id, String fullName, int age) { this.id = id; this.fullName = fullName; this.age = age; } public Students(String fullName, int age) { this.fullName = fullName; this.age = age; } //Getter And Setter public Long getId() { return id; } public String getFullName() { return fullName; } public int getAge() { return age; } public void setId(Long id) { this.id = id; } public void setFullName(String fullName) { this.fullName = fullName; } public void setAge(int age) { this.age = age; } //Tostring @Override public String toString() { return "Students{" + "id=" + id + ", fullName=" + fullName + ", age=" + age + '}'; } }