View Javadoc
1   package ejava.examples.orm.ejbql;
2   
3   import java.io.Serializable;
4   import java.math.BigDecimal;
5   import java.util.Date;
6   
7   public class Receipt implements Serializable {
8       private static final long serialVersionUID = 1L;
9       private long saleId;
10      private long customerId;
11      private Date date;
12      private double amount;
13      
14      public Receipt(long saleId, long customerId, Date date, BigDecimal amount) {
15          this(customerId, saleId, date, amount.doubleValue());
16      }
17      public Receipt(long saleId, long customerId, Date date, double amount) {
18          this.customerId = customerId;
19          this.saleId = saleId;
20          this.date = date;
21          this.amount = amount;
22      }
23      public String toString() {
24          StringBuilder text = new StringBuilder();
25          text.append("sale=" + saleId);
26          text.append(", customer=" + customerId);
27          text.append(", date=" + date);
28          text.append(", amount=" + amount);
29          return text.toString();
30      }
31      public double getAmount() {
32          return amount;
33      }
34      public long getCustomerId() {
35          return customerId;
36      }
37      public Date getDate() {
38          return date;
39      }
40      public long getSaleId() {
41          return saleId;
42      }
43  }