Advertisement
kieni17

Untitled

Mar 26th, 2020
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.42 KB | None | 0 0
  1. package dst.ass1.jpa.model.impl;
  2.  
  3. import dst.ass1.jpa.model.IPreferences;
  4. import dst.ass1.jpa.model.IRider;
  5. import dst.ass1.jpa.model.ITrip;
  6.  
  7. import javax.persistence.*;
  8. import java.util.Collection;
  9.  
  10. import static dst.ass1.jpa.util.Constants.*;
  11.  
  12.  
  13. @Entity
  14. @Table(name = T_RIDER, uniqueConstraints = { @UniqueConstraint(columnNames = {M_RIDER_ACCOUNT, M_RIDER_BANK_CODE}) })
  15. public class Rider extends PlatformUser implements IRider {
  16.  
  17.     @Column(name = M_RIDER_EMAIL, unique = true, nullable = false)
  18.     private String email;
  19.  
  20.     @Column(name = M_RIDER_PASSWORD, columnDefinition = "VARBINARY(20)")
  21.     private byte[] password;
  22.  
  23.     @Column(name = M_RIDER_ACCOUNT)
  24.     private String accountNo;
  25.  
  26.     @Column(name = M_RIDER_BANK_CODE)
  27.     private String bankCode;
  28.  
  29.   //  @Column(name = M_RIDER_TRIPS)
  30.     @OneToMany(targetEntity = Trip.class, mappedBy = "rider")
  31.  //   @JoinTable(name = I_TRIP)
  32.     private Collection<ITrip> trips;
  33.  
  34.    // @Column(name = M_RIDER_PREFERENCES)
  35.     @OneToOne(targetEntity = Preferences.class, optional = false, cascade = CascadeType.REMOVE)
  36.     @JoinColumn(name = I_PREFERENCES, unique = true)
  37.     private IPreferences preferences;
  38.  
  39.  
  40.     @Override
  41.     public String getEmail() {
  42.         return email;
  43.     }
  44.  
  45.     @Override
  46.     public void setEmail(String email) {
  47.         this.email = email;
  48.     }
  49.  
  50.     @Override
  51.     public byte[] getPassword() {
  52.         return password;
  53.     }
  54.  
  55.     @Override
  56.     public void setPassword(byte[] password) {
  57.         this.password = password;
  58.     }
  59.  
  60.     @Override
  61.     public String getAccountNo() {
  62.         return accountNo;
  63.     }
  64.  
  65.     @Override
  66.     public void setAccountNo(String accountNo) {
  67.         this.accountNo = accountNo;
  68.     }
  69.  
  70.     @Override
  71.     public String getBankCode() {
  72.         return bankCode;
  73.     }
  74.  
  75.     @Override
  76.     public void setBankCode(String bankCode) {
  77.         this.bankCode = bankCode;
  78.     }
  79.  
  80.     @Override
  81.     public IPreferences getPreferences() {
  82.         return preferences;
  83.     }
  84.  
  85.     @Override
  86.     public void setPreferences(IPreferences preferences) {
  87.         this.preferences = preferences;
  88.     }
  89.  
  90.     @Override
  91.     public Collection<ITrip> getTrips() {
  92.         return trips;
  93.     }
  94.  
  95.     @Override
  96.     public void setTrips(Collection<ITrip> trips) {
  97.         this.trips = trips;
  98.     }
  99.  
  100.     @Override
  101.     public void addTrip(ITrip trip) {
  102.         this.trips.add(trip);
  103.     }
  104.  
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement