Skip to content

Commit

Permalink
#551 @lob annotated fields removed, for large strings, used 2048 colu…
Browse files Browse the repository at this point in the history
…mn length.
  • Loading branch information
alitpc25 committed Dec 11, 2023
1 parent 6f7f3b5 commit 60d3dfe
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ public class Action extends BaseEntity {
@JoinColumn(name = "verifier_id")
private User verifier;

@Lob
@Column(length = 3000)
@Column(length = 2048)
private String description;

private LocalDateTime dueDate;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.groupa1.resq.entity;

import com.groupa1.resq.entity.enums.EEventType;
import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
Expand All @@ -25,8 +24,7 @@ public class Event extends BaseEntity {
@JoinColumn(name = "reporter_id")
private User reporter;

@Lob
@Column(length = 3000)
@Column(length = 2048)
private String description;

private LocalDateTime reportDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class Feedback extends BaseEntity {
@JoinColumn(name = "creator_id")
private User creator;

@Lob
@Column(length = 3000)
@Column(length = 2048)
private String message;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public class Info extends BaseEntity{
@JoinColumn(name = "user_id")
private User user;

@Lob
@Column(length = 3000)
@Column(length = 2048)
private String description;

private BigDecimal latitude;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public class Notification extends BaseEntity{

private String title;

@Lob
@Column(length = 1000)
@Column(length = 2048)
private String body;

private boolean isRead;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.HashSet;
Expand Down Expand Up @@ -41,8 +40,7 @@ public class Task extends BaseEntity {
@Enumerated(EnumType.STRING)
private EStatus status;

@Lob
@Column(length = 3000)
@Column(length = 2048)
private String description;

public Task() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public class User extends BaseEntity {
@Enumerated(EnumType.STRING)
private Set<EUserRole> roles = new HashSet<>();

@OneToOne(fetch = FetchType.LAZY, mappedBy = "user")
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "user_profile_id", referencedColumnName = "id")
private UserProfile userProfile;

@OneToMany(fetch = FetchType.LAZY, mappedBy="requester")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@Entity
@Table( name = "USER_PROFILE")
@Data
@EqualsAndHashCode(exclude = {"user"})
@EqualsAndHashCode(callSuper = true, exclude = {"user"})
@ToString(exclude = {"user"})
public class UserProfile extends BaseEntity{

Expand All @@ -26,8 +26,7 @@ public class UserProfile extends BaseEntity{
@Enumerated(EnumType.STRING)
private EGender gender;

@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "user_id", unique = true)
@OneToOne(mappedBy = "userProfile")
private User user;

private boolean isEmailConfirmed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@


import com.groupa1.resq.entity.Event;
import com.groupa1.resq.entity.Need;
import com.groupa1.resq.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface EventRepository extends JpaRepository<Event, Long> {
List<Event> findByReporter(User reporter);

Expand Down

0 comments on commit 60d3dfe

Please sign in to comment.