Skip to content

Commit

Permalink
Use Long as ID and GenerationType.IDENTITY)
Browse files Browse the repository at this point in the history
  • Loading branch information
rogargon committed Feb 23, 2025
1 parent ec9a4ca commit f754abb
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class Category extends UriEntity<Long> {

@Id
@GeneratedValue()
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package cat.udl.eps.softarch.tfgfinder.domain;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import lombok.Data;
import lombok.EqualsAndHashCode;
Expand All @@ -12,6 +14,7 @@
public class Chat extends UriEntity<Long>{

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

}
}
21 changes: 5 additions & 16 deletions src/main/java/cat/udl/eps/softarch/tfgfinder/domain/Interest.java
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
package cat.udl.eps.softarch.tfgfinder.domain;

import com.fasterxml.jackson.annotation.JsonProperty;

import jakarta.persistence.*;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

import java.time.ZonedDateTime;
import java.util.Collection;

@Entity
@Table(name = "interest")
@Table(name = "interest")
@Data
@EqualsAndHashCode(callSuper = true)
public class Interest extends UriEntity<String> {
public class Interest extends UriEntity<Long> {

@Id
private String id;
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@DateTimeFormat
private ZonedDateTime when;
Expand All @@ -40,4 +29,4 @@ public enum Status {

@Enumerated (EnumType.STRING)
private Status status;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
public class Invite extends UriEntity<Long> {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
public class Message extends UriEntity<Long> {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class Proposal extends UriEntity<Long> {

@Id
@GeneratedValue()
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;


Expand Down Expand Up @@ -46,4 +46,4 @@ public class Proposal extends UriEntity<Long> {
@ManyToOne
private User user; // Reference to the User entity

}
}

0 comments on commit f754abb

Please sign in to comment.