1 package ejava.examples.orm.inheritance.annotated;
2
3 import javax.persistence.*;
4
5
6
7
8
9
10
11 @Entity
12 @Table(name="ORMINH_CHECKING")
13 public class CheckingAccount extends Account {
14 private double fee;
15
16 public CheckingAccount() {}
17 public CheckingAccount(long id) { super(id); }
18
19 public void withdraw(double amount) throws AccountException {
20 super.setBalance(super.getBalance() - fee);
21 }
22
23 public double getFee() { return fee; }
24 public void setFee(double fee) {
25 this.fee = fee;
26 }
27
28 public String toString() {
29 StringBuilder text = new StringBuilder(super.toString());
30 text.append(", fee=" + fee);
31 return text.toString();
32 }
33 }