1 package org.hibernate.ce.auction.model; 2 3 import javax.persistence.*; 4 5 14 @Entity(access = AccessType.FIELD) 15 @Table(name = "CREDIT_CARD") 16 @Inheritance(strategy = InheritanceType.JOINED) 17 @JoinColumn(name = "CREDIT_CARD_ID") 18 public class CreditCard extends BillingDetails { 19 20 @org.hibernate.annotations.Type(type = "creditcard_type") 22 @Column(name = "CC_TYPE", nullable = false) 23 private CreditCardType type; 24 25 @Column(name = "CC_NUMBER", nullable = false, updatable = false) 26 private String number; 27 28 @Column(name = "EXP_MONTH", nullable = false, updatable = false) 29 private String expMonth; 30 31 @Column(name = "EXP_YEAR", nullable = false, updatable = false) 32 private String expYear; 33 34 37 CreditCard() { super(); } 38 39 48 public CreditCard(String ownerName, User user, String number, CreditCardType type, 49 String expMonth, String expYear) { 50 super(ownerName, user); 51 this.type = type; 52 this.number = number; 53 this.expMonth = expMonth; 54 this.expYear = expYear; 55 } 56 57 59 public CreditCardType getType() { return type; } 60 61 public String getNumber() { return number; } 62 63 public String getExpMonth() { return expMonth; } 64 65 public String getExpYear() { return expYear; } 66 67 69 public String toString() { 70 return "CreditCard ('" + getId() + "'), " + 71 "Type: '" + getType() + "'"; 72 } 73 74 76 public boolean isValid() { 77 return getType().isValid(this); 79 } 80 81 } 82 | Popular Tags |