-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add address and postal code to user entity #2
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
import java.util.Date; | ||
import java.util.Set; | ||
|
||
@Setter | ||
|
@@ -19,14 +20,26 @@ public class User { | |
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false) | ||
private String name; | ||
|
||
@Column(nullable = false, unique = true) | ||
private String username; | ||
|
||
@Column(nullable = false, unique = true) | ||
private String email; | ||
|
||
@Column(nullable = false) | ||
private String password; | ||
|
||
private String address; | ||
|
||
@Column(unique = true) | ||
private String postalCode; | ||
|
||
private Date birthDate; | ||
Comment on lines
+36
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New fields - private String address;
+ @Column(nullable = false)
+ private String address;
- @Column(unique = true)
- private String postalCode;
+ private String postalCode;
- private Date birthDate;
+ private LocalDate birthDate; |
||
|
||
@ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) | ||
@JoinTable(name = "users_roles", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code Review:Bug risks:
Improvement suggestions:
Remember that further specific optimizations or improvements would depend on the context of how this class is being used within the application. |
||
joinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id"), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeRabbit
The import statement for
java.util.Date
has been added. However, it's recommended to usejava.time.LocalDate
orjava.time.LocalDateTime
instead ofjava.util.Date
for date-time manipulation in modern Java applications. The newer classes provide a more comprehensive and user-friendly operation set.