-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add LatestTokenBalance entity
- Loading branch information
1 parent
f2e3c21
commit cecdefc
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
...main/java/org/cardanofoundation/explorer/common/entity/ledgersync/LatestTokenBalance.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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.cardanofoundation.explorer.common.entity.ledgersync; | ||
|
||
import java.math.BigInteger; | ||
|
||
import jakarta.persistence.AttributeOverride; | ||
import jakarta.persistence.AttributeOverrides; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Embedded; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.IdClass; | ||
import jakarta.persistence.Table; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
import org.cardanofoundation.explorer.common.entity.compositeKey.AddressBalanceId; | ||
import org.hibernate.annotations.DynamicUpdate; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@SuperBuilder | ||
@Entity | ||
@Table(name = "latest_token_balance") | ||
@IdClass(AddressBalanceId.class) | ||
public class LatestTokenBalance { | ||
|
||
@Id | ||
@Column(name = "address") | ||
private String address; | ||
|
||
@Id | ||
@Column(name = "unit") | ||
private String unit; | ||
|
||
@Id | ||
@Column(name = "slot") | ||
private Long slot; | ||
|
||
@Embedded | ||
@AttributeOverrides({ | ||
@AttributeOverride( | ||
name = "address", | ||
column = @Column(name = "address", insertable = false, updatable = false)), | ||
@AttributeOverride( | ||
name = "unit", | ||
column = @Column(name = "unit", insertable = false, updatable = false)), | ||
@AttributeOverride( | ||
name = "slot", | ||
column = @Column(name = "slot", insertable = false, updatable = false)) | ||
}) | ||
private AddressBalanceId id; | ||
|
||
@Column(name = "quantity") | ||
private BigInteger quantity; | ||
} |