Pseudocode to go to point:
@Entity
Person {
@Id
Integer id;
String SSN;
String name;
}
Use case for repository or service:
personRepository.save(new Person(ssn:"123456", name:"jeff")):
- id - unique and auto-incremental primary key
- SSN is unique and is a person identifier
- name is just a string and can be changed.
hibernate merge() /, id, ( , ), , SSN , ( , , )