1 package xpetstore.domain.signon.ejb; 2 3 import javax.persistence.Column; 4 import javax.persistence.Entity; 5 import javax.persistence.Id; 6 import javax.persistence.Table; 7 8 9 30 @Entity(name="Account") 31 @Table(name="T_ACCOUNT") 32 public class Account 33 { 34 private String userId; 35 private String password; 36 37 public Account() 38 { 39 40 } 41 42 public Account(String userId, String password) 43 { 44 this.userId = userId; 45 this.password = password; 46 } 47 48 53 public boolean matchPassword( String password ) 54 { 55 return ( password == null ) 56 ? ( getPassword( ) == null ) 57 : password.equals( getPassword( ) ); 58 } 59 60 70 @Id 71 @Column(name="userId", length=10) 72 public String getUserId( ) 73 { 74 return userId; 75 } 76 77 public void setUserId( String userId ) 78 { 79 this.userId = userId; 80 } 81 82 88 @Column(name="pwd", length=10) 89 public String getPassword( ) 90 { 91 return password; 92 } 93 94 public void setPassword( String password ) 95 { 96 this.password = password; 97 } 98 99 public String toString() 100 { 101 StringBuffer buffer = new StringBuffer (200); 102 buffer.append("[Account: userId " + userId); 103 buffer.append(", password " + password); 104 buffer.append("]"); 105 106 return buffer.toString(); 107 } 108 109 } 110 | Popular Tags |