Rev 21714 | Rev 22009 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.dao.entity.fofo;import java.io.Serializable;import javax.persistence.Column;import javax.persistence.Entity;import javax.persistence.EnumType;import javax.persistence.Enumerated;import javax.persistence.GeneratedValue;import javax.persistence.GenerationType;import javax.persistence.Id;import javax.persistence.NamedQueries;import javax.persistence.NamedQuery;import javax.persistence.Table;import javax.persistence.UniqueConstraint;import com.spice.profitmandi.dao.enumuration.fofo.PaymentOptionType;/*** This class basically contains api details** @author ashikali**/@Entity@Table(name="fofo.payment_option", schema = "fofo", uniqueConstraints = {@UniqueConstraint(columnNames = {"order_id","type"})})@NamedQueries({@NamedQuery(name = "PaymentOption.selectById", query = "select po from PaymentOption po where po.id = :id"),@NamedQuery(name = "PaymentOption.selectByOrderId", query = "select po from PaymentOption po where po.orderId = :orderId"),@NamedQuery(name = "PaymentOption.selectTotalAmountByType", query = "select sum(po.amount) from PaymentOption po where po.type = :type group by po.type"),@NamedQuery(name = "PaymentOption.selectTotalAmountByOrderId", query = "select sum(po.amount) from PaymentOption po where po.orderId = :orderId group by po.orderId")})public class PaymentOption implements Serializable{private static final long serialVersionUID = 1L;public PaymentOption() {}@Id@Column(name="id")@GeneratedValue(strategy = GenerationType.IDENTITY)private int id;@Column(name = "order_id")private int orderId;@Enumerated(EnumType.STRING)@Column(name = "type")private PaymentOptionType type;@Column(name = "amount")private float amount;public int getId() {return id;}public void setId(int id) {this.id = id;}public int getOrderId() {return orderId;}public void setOrderId(int orderId) {this.orderId = orderId;}public PaymentOptionType getType() {return type;}public void setType(PaymentOptionType type) {this.type = type;}public float getAmount() {return amount;}public void setAmount(float amount) {this.amount = amount;}@Overridepublic int hashCode() {final int prime = 31;int result = 1;result = prime * result + Float.floatToIntBits(amount);result = prime * result + id;result = prime * result + orderId;result = prime * result + ((type == null) ? 0 : type.hashCode());return result;}@Overridepublic boolean equals(Object obj) {if (this == obj)return true;if (obj == null)return false;if (getClass() != obj.getClass())return false;PaymentOption other = (PaymentOption) obj;if (Float.floatToIntBits(amount) != Float.floatToIntBits(other.amount))return false;if (id != other.id)return false;if (orderId != other.orderId)return false;if (type != other.type)return false;return true;}@Overridepublic String toString() {return "PaymentOption [id=" + id + ", orderId=" + orderId + ", type=" + type + ", amount=" + amount + "]";}}