All pastes #638823 Raw Edit

Mine

public java v1 · immutable
#638823 ·published 2007-07-30 03:20 UTC
rendered paste body
/* * Compte.java * * Created on 29 juillet 2007, 02:20 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */package vente_comptant.persistence;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.NamedQueries;import javax.persistence.NamedQuery;import javax.persistence.Table;/** * Entity class Compte *  * @author remi */@Entity@Table(name = "COMPTE")@NamedQueries( {        @NamedQuery(name = "Compte.findById", query = "SELECT c FROM Compte c WHERE c.id = :id"),        @NamedQuery(name = "Compte.findByCompte", query = "SELECT c FROM Compte c WHERE c.compte = :compte"),        @NamedQuery(name = "Compte.findByLibelle", query = "SELECT c FROM Compte c WHERE c.libelle = :libelle")    })public class Compte implements Serializable {    @Id    @GeneratedValue(strategy = GenerationType.IDENTITY)    @Column(name = "ID", nullable = false)    private Integer id;    @Column(name = "COMPTE", nullable = false)    private int compte;    @Column(name = "LIBELLE", nullable = false)    private String libelle;        /** Creates a new instance of Compte */    public Compte() {    }    /**     * Creates a new instance of Compte with the specified values.     * @param id the id of the Compte     */    public Compte(Integer id) {        this.id = id;    }    /**     * Creates a new instance of Compte with the specified values.     * @param id the id of the Compte     * @param compte the compte of the Compte     * @param libelle the libelle of the Compte     */    public Compte(int compte, String libelle) {        this.compte = compte;        this.libelle = libelle;    }    /**     * Gets the id of this Compte.     * @return the id     */    public Integer getId() {        return this.id;    }    /**     * Sets the id of this Compte to the specified value.     * @param id the new id     */    public void setId(Integer id) {        this.id = id;    }    /**     * Gets the compte of this Compte.     * @return the compte     */    public int getCompte() {        return this.compte;    }    /**     * Sets the compte of this Compte to the specified value.     * @param compte the new compte     */    public void setCompte(int compte) {        this.compte = compte;    }    /**     * Gets the libelle of this Compte.     * @return the libelle     */    public String getLibelle() {        return this.libelle;    }    /**     * Sets the libelle of this Compte to the specified value.     * @param libelle the new libelle     */    public void setLibelle(String libelle) {        this.libelle = libelle;    }    /**     * Returns a hash code value for the object.  This implementation computes      * a hash code value based on the id fields in this object.     * @return a hash code value for this object.     */    @Override    public int hashCode() {        int hash = 0;        hash += (this.id != null ? this.id.hashCode() : 0);        return hash;    }    /**     * Determines whether another object is equal to this Compte.  The result is      * <code>true</code> if and only if the argument is not null and is a Compte object that      * has the same id field values as this object.     * @param object the reference object with which to compare     * @return <code>true</code> if this object is the same as the argument;     * <code>false</code> otherwise.     */    @Override    public boolean equals(Object object) {        // TODO: Warning - this method won't work in the case the id fields are not set        if (!(object instanceof Compte)) {            return false;        }        Compte other = (Compte)object;        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) return false;        return true;    }    /**     * Returns a string representation of the object.  This implementation constructs      * that representation based on the id fields.     * @return a string representation of the object.     */    @Override    public String toString() {        return "vente_comptant.persistence.Compte[id=" + id + "]";    }    }