com.clican.pluto.transaction.pojo.Test1.java Source code

Java tutorial

Introduction

Here is the source code for com.clican.pluto.transaction.pojo.Test1.java

Source

/**
 * The Clican-Pluto software suit is Copyright 2009, Clican Company
 * and individual contributors, and is licensed under the GNU LGPL.
 *
 * @author clican
 *
 */
package com.clican.pluto.transaction.pojo;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;

@Entity
@Table(name = "Test1")
public class Test1 implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = -3049231142685724714L;

    private Long id;

    private String name;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "ID")
    public Long getId() {
        return id;
    }

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

    @Column(name = "NAME")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * @see java.lang.Object#toString()
     */
    public String toString() {
        return new ToStringBuilder(this).append("name", this.name).append("id", this.id).toString();
    }

    /**
     * @see java.lang.Object#hashCode()
     */
    public int hashCode() {
        return new HashCodeBuilder(100801895, -4034255).appendSuper(super.hashCode()).append(this.name)
                .append(this.id).toHashCode();
    }

    /**
     * @see java.lang.Object#equals(Object)
     */
    public boolean equals(Object object) {
        if (!(object instanceof Test1)) {
            return false;
        }
        Test1 rhs = (Test1) object;
        return new EqualsBuilder().appendSuper(super.equals(object)).append(this.name, rhs.name)
                .append(this.id, rhs.id).isEquals();
    }

}

//$Id$