Skip to content

Commit

Permalink
updated entities for connections
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladik-gif committed Oct 23, 2024
1 parent e70acee commit f62e089
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/chat/yourway/model/Contact.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class Contact implements UserDetails {
@OneToMany(mappedBy = "sender", fetch = FetchType.LAZY)
private List<Message> messages;

@ManyToMany(fetch = FetchType.LAZY)
@ManyToMany
@JoinTable(
schema = "chat",
name = "unread_messages",
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/chat/yourway/model/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Message {
@Column(nullable = false)
private LocalDateTime timestamp;

@ManyToOne(fetch = FetchType.EAGER)
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "topic_id", referencedColumnName = "id", nullable = false)
private Topic topic;

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/chat/yourway/model/Topic.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@ public class Topic {
@CreationTimestamp
private LocalDateTime createdAt;

@ManyToMany(fetch = FetchType.LAZY)
@ManyToMany
@JoinTable(
schema = "chat",
name = "topic_tags",
joinColumns = @JoinColumn(name = "topic_id"),
inverseJoinColumns = @JoinColumn(name = "tag_id"))
private Set<Tag> tags;

@ManyToMany(fetch = FetchType.LAZY)
@ManyToMany
@JoinTable(
schema = "chat",
name = "topic_contacts",
joinColumns = @JoinColumn(name = "topic_id"),
inverseJoinColumns = @JoinColumn(name = "contact_id"))
private List<Contact> topicSubscribers = new ArrayList<>();

@ManyToMany(fetch = FetchType.LAZY)
@ManyToMany
@JoinTable(
schema = "chat",
name = "topic_complaints",
Expand Down

0 comments on commit f62e089

Please sign in to comment.