Skip to content

Commit

Permalink
Use EmbeddedId in ReleaseStatsPerAssemblyV2
Browse files Browse the repository at this point in the history
  • Loading branch information
tcezard committed Mar 27, 2024
1 parent 59f9dc0 commit cadf7d9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
5 changes: 4 additions & 1 deletion eva-release/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@
<artifactId>springfox-swagger2</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>io.hypersistence</groupId>
<artifactId>hypersistence-utils-hibernate-52</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,21 @@
*/
package uk.ac.ebi.eva.release.models;

import io.hypersistence.utils.hibernate.type.array.IntArrayType;
import io.hypersistence.utils.hibernate.type.array.ListArrayType;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;

import javax.persistence.*;
import java.util.Objects;

@Entity
@IdClass(ReleaseStatsPerAssemblyV2PK.class)
@Table(name = "release_rs_count_per_assembly", schema="eva_stats")
public class ReleaseStatsPerAssemblyV2 {

@Id

@EmbeddedId
ReleaseStatsPerAssemblyV2PK releaseStatsPerAssemblyV2Id;

@Column(insertable = false, updatable = false)
private int releaseVersion;
@Id
private String assemblyAccession;

@Type(type = "int-array")
@Column(
Expand Down Expand Up @@ -74,21 +72,19 @@ public void setTaxonomyIds(int[] taxonomyIds) {
}

public String getAssemblyAccession() {
return assemblyAccession;
return releaseStatsPerAssemblyV2Id.getAssemblyAccession();
}

public void setAssemblyAccession(String assemblyAccession) {
this.assemblyAccession = assemblyAccession;
releaseStatsPerAssemblyV2Id.setAssemblyAccession(assemblyAccession);
}



public int getReleaseVersion() {
return releaseVersion;
return releaseStatsPerAssemblyV2Id.getReleaseVersion();
}

public void setReleaseVersion(int releaseVersion) {
this.releaseVersion = releaseVersion;
releaseStatsPerAssemblyV2Id.setReleaseVersion(releaseVersion);
}


Expand All @@ -107,7 +103,7 @@ public Long getCurrentRs() {
public void setCurrentRs(Long currentRs) {
this.currentRs = currentRs;
}

public Long getNewMergedRs() {
return newMergedRs;
}
Expand Down Expand Up @@ -185,13 +181,13 @@ public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ReleaseStatsPerAssemblyV2 assembly = (ReleaseStatsPerAssemblyV2) o;
return releaseVersion == assembly.releaseVersion &&
Objects.equals(assemblyAccession, assembly.assemblyAccession);
return this.getReleaseVersion() == assembly.getReleaseVersion() &&
Objects.equals(this.getAssemblyAccession(), assembly.getAssemblyAccession());
}

@Override
public int hashCode() {
return Objects.hash(assemblyAccession, releaseVersion);
return Objects.hash(this.getAssemblyAccession(), this.getReleaseVersion());
}

}

0 comments on commit cadf7d9

Please sign in to comment.