alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (QuotedFieldsEntity.java)

This example Hibernate source code file (QuotedFieldsEntity.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

audited, column, column, entity, generatedvalue, id, integer, integer, long, override, quotedfieldsentity, quotedfieldsentity, string, string

The Hibernate QuotedFieldsEntity.java source code

package org.hibernate.envers.test.integration.naming.quotation;

import org.hibernate.envers.Audited;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

/**
 * @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
 */
@Entity
public class QuotedFieldsEntity {
    @Id
    @GeneratedValue
    @Column(name = "`id#`")
    private Long id;

    @Column(name = "`#data1`")
    @Audited
    private String data1;

    @Column(name = "`#data2`")
    @Audited
    private Integer data2;

    public QuotedFieldsEntity() {
    }

    public QuotedFieldsEntity(String data1, Integer data2) {
        this.data1 = data1;
        this.data2 = data2;
    }

    public QuotedFieldsEntity(Long id, String data1, Integer data2) {
        this.id = id;
        this.data1 = data1;
        this.data2 = data2;
    }

    public Long getId() {
        return id;
    }

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

    public String getData1() {
        return data1;
    }

    public void setData1(String data1) {
        this.data1 = data1;
    }

    public Integer getData2() {
        return data2;
    }

    public void setData2(Integer data2) {
        this.data2 = data2;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof QuotedFieldsEntity)) return false;

        QuotedFieldsEntity that = (QuotedFieldsEntity) o;

        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (data1 != null ? !data1.equals(that.data1) : that.data1 != null) return false;
        if (data2 != null ? !data2.equals(that.data2) : that.data2 != null) return false;

        return true;
    }

    public int hashCode() {
        int result;
        result = (id != null ? id.hashCode() : 0);
        result = 31 * result + (data1 != null ? data1.hashCode() : 0);
        result = 31 * result + (data2 != null ? data2.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "QuotedFieldsEntity{" +
                "id=" + id +
                ", data1='" + data1 + '\'' +
                ", data2=" + data2 +
                '}';
    }
}

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate QuotedFieldsEntity.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.