Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package dst.ass1.jpa.model.impl;
- import dst.ass1.jpa.model.IPreferences;
- import dst.ass1.jpa.model.IRider;
- import dst.ass1.jpa.model.ITrip;
- import javax.persistence.*;
- import java.util.Collection;
- import static dst.ass1.jpa.util.Constants.*;
- @Entity
- @Table(name = T_RIDER, uniqueConstraints = { @UniqueConstraint(columnNames = {M_RIDER_ACCOUNT, M_RIDER_BANK_CODE}) })
- public class Rider extends PlatformUser implements IRider {
- @Column(name = M_RIDER_EMAIL, unique = true, nullable = false)
- private String email;
- @Column(name = M_RIDER_PASSWORD, columnDefinition = "VARBINARY(20)")
- private byte[] password;
- @Column(name = M_RIDER_ACCOUNT)
- private String accountNo;
- @Column(name = M_RIDER_BANK_CODE)
- private String bankCode;
- // @Column(name = M_RIDER_TRIPS)
- @OneToMany(targetEntity = Trip.class, mappedBy = "rider")
- // @JoinTable(name = I_TRIP)
- private Collection<ITrip> trips;
- // @Column(name = M_RIDER_PREFERENCES)
- @OneToOne(targetEntity = Preferences.class, optional = false, cascade = CascadeType.REMOVE)
- @JoinColumn(name = I_PREFERENCES, unique = true)
- private IPreferences preferences;
- @Override
- public String getEmail() {
- return email;
- }
- @Override
- public void setEmail(String email) {
- this.email = email;
- }
- @Override
- public byte[] getPassword() {
- return password;
- }
- @Override
- public void setPassword(byte[] password) {
- this.password = password;
- }
- @Override
- public String getAccountNo() {
- return accountNo;
- }
- @Override
- public void setAccountNo(String accountNo) {
- this.accountNo = accountNo;
- }
- @Override
- public String getBankCode() {
- return bankCode;
- }
- @Override
- public void setBankCode(String bankCode) {
- this.bankCode = bankCode;
- }
- @Override
- public IPreferences getPreferences() {
- return preferences;
- }
- @Override
- public void setPreferences(IPreferences preferences) {
- this.preferences = preferences;
- }
- @Override
- public Collection<ITrip> getTrips() {
- return trips;
- }
- @Override
- public void setTrips(Collection<ITrip> trips) {
- this.trips = trips;
- }
- @Override
- public void addTrip(ITrip trip) {
- this.trips.add(trip);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement