@@ -0,0 +1,3227 @@
+package io.teiler.server.persistence.entities;%0A%0Aimport java.sql.Timestamp;%0Aimport java.time.Instant;%0A%0Aimport javax.persistence.Column;%0Aimport javax.persistence.DiscriminatorColumn;%0Aimport javax.persistence.Entity;%0Aimport javax.persistence.EnumType;%0Aimport javax.persistence.Enumerated;%0Aimport javax.persistence.GeneratedValue;%0Aimport javax.persistence.GenerationType;%0Aimport javax.persistence.Id;%0Aimport javax.persistence.Inheritance;%0Aimport javax.persistence.JoinColumn;%0Aimport javax.persistence.ManyToOne;%0Aimport javax.persistence.PrePersist;%0Aimport javax.persistence.PreUpdate;%0Aimport javax.persistence.SequenceGenerator;%0Aimport javax.persistence.Table;%0Aimport javax.validation.constraints.NotNull;%0A%0Aimport io.teiler.server.dto.TransactionType;%0A%0A/**%0A * Entity representing an entry of the %3Ccode%3Etransaction%3C/code%3E-table.%0A *%0A * @author pbaechli%0A */%0A@Entity%0A@Table(name = %22%60transaction%60%22)%0A@Inheritance%0A@DiscriminatorColumn(name = %22type%22)%0Apublic class TransactionEntity %7B%0A%0A    @Id%0A    @SequenceGenerator(name = %22transaction_id_seq%22,%0A        sequenceName = %22transaction_id_seq%22,%0A        allocationSize = 1)%0A    @GeneratedValue(strategy = GenerationType.SEQUENCE,%0A        generator = %22transaction_id_seq%22)%0A    @Column(name = %22id%22)%0A    private Integer id;%0A%0A    @NotNull%0A    @Column(name = %22amount%22)%0A    private Integer amount;%0A    %0A    @NotNull%0A    @Enumerated(EnumType.STRING)%0A    @Column(name = %22type%22, updatable = false, insertable = false)%0A    private TransactionType transactionType;%0A%0A    @ManyToOne%0A    @JoinColumn(name = %22payer%22)%0A    private PersonEntity payer;%0A    %0A    @NotNull%0A    @Column(name = %22update_time%22)%0A    private Timestamp updateTime;%0A%0A    @NotNull%0A    @Column(name = %22create_time%22)%0A    private Timestamp createTime;%0A    %0A    public TransactionEntity() %7B /* intentionally empty */ %7D%0A    %0A    /**%0A     * Sets the update-time and creation-time to %7B@link Instant#now()%7D.%0A     * %3Cbr%3E%0A     * %3Ci%3ENote:%3C/i%3E The creation-time will only be set if it has not been set previously. %0A     */%0A    @PreUpdate%0A    @PrePersist%0A    public void updateTimeStamps() %7B%0A        updateTime = new Timestamp(Instant.now().toEpochMilli());%0A        if (createTime == null) %7B%0A            createTime = new Timestamp(Instant.now().toEpochMilli());%0A        %7D%0A    %7D%0A%0A    public Integer getId() %7B%0A        return id;%0A    %7D%0A%0A    public void setId(Integer id) %7B%0A        this.id = id;%0A    %7D%0A%0A    public Integer getAmount() %7B%0A        return amount;%0A    %7D%0A%0A    public void setAmount(Integer amount) %7B%0A        this.amount = amount;%0A    %7D%0A%0A    public TransactionType getTransactionType() %7B%0A        return transactionType;%0A    %7D%0A%0A    public void setTransactionType(TransactionType transactionType) %7B%0A        this.transactionType = transactionType;%0A    %7D%0A%0A    public PersonEntity getPayer() %7B%0A        return payer;%0A    %7D%0A%0A    public void setPayer(PersonEntity payer) %7B%0A        this.payer = payer;%0A    %7D%0A%0A    public Timestamp getUpdateTime() %7B%0A        return updateTime;%0A    %7D%0A%0A    public void setUpdateTime(Timestamp updateTime) %7B%0A        this.updateTime = updateTime;%0A    %7D%0A%0A    public Timestamp getCreateTime() %7B%0A        return createTime;%0A    %7D%0A%0A    public void setCreateTime(Timestamp createTime) %7B%0A        this.createTime = createTime;%0A    %7D%0A    %0A%7D%0A

add transaction entity (#173)