Created
August 9, 2021 11:33
-
-
Save ereshzealous/145561088b633f51be225681c89478e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.spring.hibernate.entity; | |
| import lombok.Getter; | |
| import lombok.Setter; | |
| import org.hibernate.annotations.CreationTimestamp; | |
| import org.hibernate.annotations.GenericGenerator; | |
| import org.hibernate.annotations.UpdateTimestamp; | |
| import javax.persistence.CascadeType; | |
| import javax.persistence.Column; | |
| import javax.persistence.Entity; | |
| import javax.persistence.GeneratedValue; | |
| import javax.persistence.Id; | |
| import javax.persistence.OneToMany; | |
| import javax.persistence.Table; | |
| import java.time.LocalDateTime; | |
| import java.util.List; | |
| /** | |
| * Created on 09/August/2021 By Author Eresh, Gorantla | |
| **/ | |
| @Entity | |
| @Table(name = "user_details") | |
| @Getter | |
| @Setter | |
| public class UserDetails { | |
| @Id | |
| @GeneratedValue(generator = "system-uuid") | |
| @GenericGenerator(name = "system-uuid", strategy = "org.hibernate.id.UUIDGenerator") | |
| private String id; | |
| @Column(name = "name") | |
| private String name; | |
| @Column(name = "email") | |
| private String email; | |
| @Column(name = "mobile_number") | |
| private String mobileNumber; | |
| @Column(name = "created_at", updatable = false) | |
| @CreationTimestamp | |
| private LocalDateTime createdAt; | |
| @Column(name = "updated_at", insertable = false) | |
| @UpdateTimestamp | |
| private LocalDateTime updatedAt; | |
| @OneToMany(cascade = CascadeType.ALL, mappedBy = "userDetails") | |
| private List<Address> addresses; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment