/* * ============================================================================ * GNU Lesser General Public License * ============================================================================ * * Taylor - The Java Enterprise Application Framework. * Copyright (C) 2005 John Gilbert jgilbert01@users.sourceforge.net * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * * John Gilbert * Email: jgilbert01@users.sourceforge.net */ package com.fermland.ejb.jpa.entity; import com.fermland.ejb.jpa.entity.Commande; import com.fermland.ejb.jpa.entity.Produit; import java.io.Serializable; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.OneToOne; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; /** * @todo add comment for javadoc * * @author Berni * @generated */ @Entity(name="lignecommande") public class LigneCommande implements Serializable, Cloneable { /** @generated */ private static final long serialVersionUID = 1L; /** @generated */ public LigneCommande() { } /** * ------------------------------------------------------------------------ * The primary key. * ------------------------------------------------------------------------ * @generated */ @Id @GeneratedValue(strategy = GenerationType.AUTO) public Long getId() { return id; } /** @generated */ public void setId(final Long id) { this.id = id; } /** @generated */ private Long id = null; /** * ------------------------------------------------------------------------ * @todo add comment for javadoc * ------------------------------------------------------------------------ * @generated */ public Double getQuantite() { return quantite; } /** @generated */ public void setQuantite(final Double quantite) { this.quantite = quantite; } /** @generated */ private Double quantite = null; /** * ------------------------------------------------------------------------ * @todo add comment for javadoc * ------------------------------------------------------------------------ * @generated */ @OneToOne ( cascade={CascadeType.PERSIST, CascadeType.MERGE}) public Commande getCommande() { return commande; } /** @generated */ public void setCommande(final Commande commande) { this.commande = commande; } /** @generated */ private Commande commande = null; /** * ------------------------------------------------------------------------ * @todo add comment for javadoc * ------------------------------------------------------------------------ * @generated */ @OneToOne(optional = true, fetch = FetchType.EAGER, cascade = CascadeType.ALL) public Produit getProduit() { return produit; } /** @generated */ public void setProduit(final Produit produit) { this.produit = produit; } /** @generated */ private Produit produit = null; // ------------------------------------------------------------------------ // Utils // ------------------------------------------------------------------------ /** @generated */ public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); } /** @generated */ public LigneCommande deepClone() throws Exception { LigneCommande clone = (LigneCommande) super.clone(); clone.setId(null); return clone; } /** @generated */ @Override public int hashCode() { final int PRIME = 31; int result = 1; result = PRIME * result + ((id == null) ? super.hashCode() : id.hashCode()); return result; } /** @generated */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof LigneCommande)) return false; final LigneCommande other = (LigneCommande) obj; if (id == null) { if (other.getId() != null) return false; } else if (!id.equals(other.getId())) return false; return true; } }