OneCompiler

java 8 program

Create Product class as per the given structure with Constructor , setter and getter methods for all the fields.

Create the Interface as AdminService and include methods for CRUD operation

Create the class AdminServiceImpl and implement the AdminSerivce Interface.

AdminServiceImpl Class should have a static variable productArray with the Size of 5 when CRUD operation is performed the array should be updated for all the operations.

1 Answer

3 years ago by

package io.codejournal.springboot.mvcjpathymeleaf.entity;

import java.util.UUID;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "student")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Student {

@Id
@GeneratedValue(generator = "UUID")
@Column(name = "s_id")
private UUID id;

@Column(name = "s_first_name")
private String firstName;

@Column(name = "s_last_name")
private String lastName;

}
package io.codejournal.springboot.mvcjpathymeleaf.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "user")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class User {

@Id
@Column(name = "u_username")
private String username;

@Column(name = "u_password")
private String password;

}

3 years ago by Tyson Kai