Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

spring boot rest api

package com.fixdecode.restcruddemo.customer;
 
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import org.hibernate.annotations.NaturalId;
 
import javax.persistence.*;
 
@Getter
@Setter
@NoArgsConstructor
@Entity
public class Customer {
    @Id
    @GeneratedValue
    private Long id;
    @Column(name = "first_name")
    private String firstName;
    @Column(name = "last_name")
    private String lastName;
    @NaturalId
    @NonNull
    private String email;
    private String password;
 
    public Customer(String firstName, String lastName,String email, String password) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.email = email;
        this.password = password;
    }
}
Source by fixdecode.com #
 
PREVIOUS NEXT
Tagged: #spring #boot #rest #api
ADD COMMENT
Topic
Name
5+4 =