Skip to content

Instantly share code, notes, and snippets.

@c3l3si4n
Last active March 9, 2020 01:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c3l3si4n/8d18f789f7dc55f425edaef6fdfabb18 to your computer and use it in GitHub Desktop.
Save c3l3si4n/8d18f789f7dc55f425edaef6fdfabb18 to your computer and use it in GitHub Desktop.
@Entity
public class Customer {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
private String firstName;
private String lastName;
@Unique
private String identityNumber;
private Calendar birthDate;
protected Customer() {}
public Customer(String firstName, String lastName, String identityNumber, Calendar birthDate) {
this.firstName = firstName;
this.lastName = lastName;
this.identityNumber = identityNumber;
this.birthDate = birthDate;
}
@Override
public String toString() {
return String.format(
"Customer[id=%d, firstName='%s', lastName='%s']",
id, firstName, lastName);
}
public Long getId() {
return id;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public String getIdentificationNumber() {
return identificationNumber;
}
public Calendar getBirthDate() {
return birthDate;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment