-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Remove @DaTa and @EqualsAndHashCode annotations and replace them with @getter @Setter @tostring (excluding lazily loaded variables) and custom equals and hashcode methods - Change id datatype from int to Long in entity classes
- Loading branch information
1 parent
e98ba94
commit 3bde47b
Showing
17 changed files
with
391 additions
and
113 deletions.
There are no files selected for viewing
29 changes: 24 additions & 5 deletions
29
src/main/java/de/numcodex/feasibility_gui_backend/dse/persistence/DseProfile.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,43 @@ | ||
package de.numcodex.feasibility_gui_backend.dse.persistence; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.*; | ||
import org.hibernate.proxy.HibernateProxy; | ||
|
||
import java.io.Serializable; | ||
import java.util.Objects; | ||
|
||
@Entity | ||
@Table(name = "dse_profile", schema = "public") | ||
@Data | ||
@EqualsAndHashCode | ||
@Getter | ||
@Setter | ||
@ToString | ||
@RequiredArgsConstructor | ||
public class DseProfile implements Serializable { | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Id | ||
@Column(name = "id", nullable = false) | ||
private int id; | ||
private Long id; | ||
@Basic | ||
@Column(name = "url", nullable = false, length = -1) | ||
private String url; | ||
@Basic | ||
@Column(name = "entry", columnDefinition = "json", nullable = false) | ||
private String entry; | ||
|
||
@Override | ||
public final boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null) return false; | ||
Class<?> oEffectiveClass = o instanceof HibernateProxy ? ((HibernateProxy) o).getHibernateLazyInitializer().getPersistentClass() : o.getClass(); | ||
Class<?> thisEffectiveClass = this instanceof HibernateProxy ? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass() : this.getClass(); | ||
if (thisEffectiveClass != oEffectiveClass) return false; | ||
DseProfile that = (DseProfile) o; | ||
return getId() != null && Objects.equals(getId(), that.getId()); | ||
} | ||
|
||
@Override | ||
public final int hashCode() { | ||
return this instanceof HibernateProxy ? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass().hashCode() : getClass().hashCode(); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.