1 22 package org.jboss.ejb3.test.bank; 23 24 import java.rmi.RemoteException ; 25 import javax.ejb.CreateException ; 26 27 32 public class AccountBeanCMP extends AccountBean 33 { 34 36 public String id; 38 39 public float balance; 40 41 public Customer owner; 42 43 private boolean dirty; 44 45 47 49 public String getId() 51 { 52 return id; 53 } 54 55 public void setId(String id) 56 { 57 this.id = id; 58 dirty = true; 59 } 60 61 public float getBalance() 62 { 63 return balance; 64 } 65 66 public void setBalance(float balance) 67 { 68 this.balance = balance; 69 dirty = true; 70 } 71 72 public Customer getOwner() 73 { 74 return owner; 75 } 76 77 public void setOwner(Customer owner) 78 { 79 this.owner = owner; 80 dirty = true; 81 } 82 83 public void setData(AccountData data) 84 { 85 setBalance(data.getBalance()); 86 setOwner(data.getOwner()); 87 } 88 89 public AccountData getData() 90 { 91 AccountData data = new AccountData(); 92 data.setId(id); 93 data.setBalance(balance); 94 data.setOwner(owner); 95 return data; 96 } 97 98 public boolean isModified() 99 { 100 return dirty; 101 } 102 103 public String ejbCreate(AccountData data) throws RemoteException , 105 CreateException 106 { 107 setId(data.id); 108 setData(data); 109 dirty = false; 110 return null; 111 } 112 113 public void ejbPostCreate(AccountData data) throws RemoteException , 114 CreateException 115 { 116 } 117 118 public void ejbLoad() throws RemoteException 119 { 120 dirty = false; 121 } 122 } 123 124 144 | Popular Tags |