com.testing26thjuly_.db123testing.SelfRelationTable.java Source code

Java tutorial

Introduction

Here is the source code for com.testing26thjuly_.db123testing.SelfRelationTable.java

Source

/*Copyright (c) 2016-2017 wavemaker.com All Rights Reserved.
 This software is the confidential and proprietary information of wavemaker.com You shall not disclose such Confidential Information and shall use it only in accordance
 with the terms of the source code license agreement you entered into with wavemaker.com*/

package com.testing26thjuly_.db123testing;

/*This is a Studio Managed File. DO NOT EDIT THIS FILE. Your changes may be reverted by Studio.*/

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * SelfRelationTable generated by WaveMaker Studio.
 */
@Entity
@Table(name = "`Self Relation_ Table`", schema = "dbo")
public class SelfRelationTable implements Serializable {

    private int id;
    private Date dateCol;
    private Date datetimeCol;
    private Date timeCol;
    private Date timestampCol;
    private Boolean booleanCol;
    @JsonIgnore
    private byte[] blobCol;
    private SelfRelationTable selfRelationTableByIntCol;
    private List<SelfRelationTable> selfRelationTablesForIntCol = new ArrayList<>();

    @Id
    @Column(name = "`ID`", nullable = false, scale = 0, precision = 10)
    public int getId() {
        return this.id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Temporal(TemporalType.DATE)
    @Column(name = "`Date Col`", nullable = true)
    public Date getDateCol() {
        return this.dateCol;
    }

    public void setDateCol(Date dateCol) {
        this.dateCol = dateCol;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "`Datetime Col`", nullable = true)
    public Date getDatetimeCol() {
        return this.datetimeCol;
    }

    public void setDatetimeCol(Date datetimeCol) {
        this.datetimeCol = datetimeCol;
    }

    @Temporal(TemporalType.TIME)
    @Column(name = "`Time Col`", nullable = true)
    public Date getTimeCol() {
        return this.timeCol;
    }

    public void setTimeCol(Date timeCol) {
        this.timeCol = timeCol;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "`Timestamp Col`", nullable = true)
    public Date getTimestampCol() {
        return this.timestampCol;
    }

    public void setTimestampCol(Date timestampCol) {
        this.timestampCol = timestampCol;
    }

    @Column(name = "`Boolean Col`", nullable = true)
    public Boolean getBooleanCol() {
        return this.booleanCol;
    }

    public void setBooleanCol(Boolean booleanCol) {
        this.booleanCol = booleanCol;
    }

    @Column(name = "`Blob Col`", nullable = true)
    public byte[] getBlobCol() {
        return this.blobCol;
    }

    public void setBlobCol(byte[] blobCol) {
        this.blobCol = blobCol;
    }

    // ignoring self relation properties to avoid circular loops.
    @JsonIgnoreProperties({ "selfRelationTableByIntCol", "selfRelationTablesForIntCol" })
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "`Int Col`", referencedColumnName = "`ID`", insertable = true, updatable = true)
    public SelfRelationTable getSelfRelationTableByIntCol() {
        return this.selfRelationTableByIntCol;
    }

    public void setSelfRelationTableByIntCol(SelfRelationTable selfRelationTableByIntCol) {
        this.selfRelationTableByIntCol = selfRelationTableByIntCol;
    }

    // ignoring self relation properties to avoid circular loops.
    @JsonIgnoreProperties({ "selfRelationTableByIntCol", "selfRelationTablesForIntCol" })
    @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "selfRelationTableByIntCol")
    public List<SelfRelationTable> getSelfRelationTablesForIntCol() {
        return this.selfRelationTablesForIntCol;
    }

    public void setSelfRelationTablesForIntCol(List<SelfRelationTable> selfRelationTablesForIntCol) {
        this.selfRelationTablesForIntCol = selfRelationTablesForIntCol;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (!(o instanceof SelfRelationTable))
            return false;
        final SelfRelationTable selfRelationTable = (SelfRelationTable) o;
        return Objects.equals(getId(), selfRelationTable.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId());
    }
}