Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,38 @@
@SuperBuilder
public abstract class BaseEntity {

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

@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;

BaseEntity that = (BaseEntity) 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();
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Getter
@Setter
private Long id;

@Override
public final boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;

if (!(o instanceof BaseEntity other)) return false;

Class<?> thisEffectiveClass =
(this instanceof HibernateProxy proxy)
? proxy.getHibernateLazyInitializer().getPersistentClass()
: this.getClass();

Class<?> otherEffectiveClass =
(o instanceof HibernateProxy proxy)
? proxy.getHibernateLazyInitializer().getPersistentClass()
: o.getClass();

if (!thisEffectiveClass.equals(otherEffectiveClass)) return false;

return getId() != null && Objects.equals(getId(), other.getId());
}

@Override
public final int hashCode() {
return (this instanceof HibernateProxy proxy)
? proxy.getHibernateLazyInitializer().getPersistentClass().hashCode()
: getClass().hashCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public void addCardHistory(CardHistory cardHistory) {
cardHistory.setCard(this);
}

@SuppressWarnings("unused")
public static class CardBuilder {
private Long id;
private String front;
Expand Down Expand Up @@ -159,15 +160,15 @@ public Card build() {
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 (!(o instanceof Card other)) return false;
Class<?> oEffectiveClass = o instanceof HibernateProxy proxy ? proxy.getHibernateLazyInitializer().getPersistentClass() : o.getClass();
Class<?> thisEffectiveClass = this instanceof HibernateProxy proxy ? proxy.getHibernateLazyInitializer().getPersistentClass() : this.getClass();
if (thisEffectiveClass != oEffectiveClass) return false;
Card card = (Card) o;
return getId() != null && Objects.equals(getId(), card.getId());
return getId() != null && Objects.equals(getId(), other.getId());
}

@Override
public final int hashCode() {
return this instanceof HibernateProxy ? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass().hashCode() : getClass().hashCode();
return this instanceof HibernateProxy proxy ? proxy.getHibernateLazyInitializer().getPersistentClass().hashCode() : getClass().hashCode();
}
}

This file was deleted.

This file was deleted.

This file was deleted.