1414import java .lang .reflect .Method ;
1515import java .util .Comparator ;
1616
17+ import jakarta .persistence .Table ;
18+ import jakarta .persistence .Column ;
19+ import jakarta .persistence .Entity ;
20+ import jakarta .persistence .GeneratedValue ;
21+ import jakarta .persistence .GenerationType ;
22+ import jakarta .persistence .Id ;
23+ import jakarta .persistence .JoinColumn ;
24+ import jakarta .persistence .ManyToOne ;
1725import org .codehaus .jackson .annotate .JsonIgnore ;
1826import org .hibernate .envers .Audited ;
1927import org .hibernate .search .engine .backend .types .Sortable ;
4351 */
4452@ Indexed
4553@ Audited
54+ @ Entity
55+ @ Table (name = "patient_identifier" )
4656public class PatientIdentifier extends BaseChangeableOpenmrsData implements java .io .Serializable , Cloneable , Comparable <PatientIdentifier > {
4757
4858 public static final long serialVersionUID = 1123121L ;
@@ -55,29 +65,42 @@ public class PatientIdentifier extends BaseChangeableOpenmrsData implements java
5565 * @since 1.5
5666 */
5767 @ DocumentId
68+ @ Id
69+ @ GeneratedValue (strategy = GenerationType .IDENTITY )
70+ @ Column (name = "patient_identifier_id" , nullable = false )
5871 private Integer patientIdentifierId ;
5972
73+ @ ManyToOne
74+ @ JoinColumn (name = "patient_id" , nullable = false )
6075 @ IndexedEmbedded (includeEmbeddedObjectId = true )
6176 @ AssociationInverseSide (inversePath = @ ObjectPath ({
6277 @ PropertyValue (propertyName = "identifiers" )
6378 }))
6479 private Patient patient ;
65-
80+
6681 @ FullTextField (name = "identifierPhrase" , analyzer = SearchAnalysis .PHRASE_ANALYZER )
6782 @ FullTextField (name = "identifierExact" , analyzer = SearchAnalysis .EXACT_ANALYZER )
6883 @ FullTextField (name = "identifierStart" , analyzer = SearchAnalysis .START_ANALYZER , searchAnalyzer = SearchAnalysis .EXACT_ANALYZER )
6984 @ FullTextField (name = "identifierAnywhere" , analyzer = SearchAnalysis .ANYWHERE_ANALYZER , searchAnalyzer = SearchAnalysis .EXACT_ANALYZER )
7085 @ KeywordField (name = "identifierExact_sort" , sortable = Sortable .YES )
86+ @ Column (name = "identifier" , length = 50 , nullable = false )
7187 private String identifier ;
7288
89+ @ ManyToOne
90+ @ JoinColumn (name = "identifier_type" , nullable = false )
7391 @ IndexedEmbedded (includeEmbeddedObjectId = true )
7492 @ IndexingDependency (reindexOnUpdate = ReindexOnUpdate .SHALLOW )
7593 private PatientIdentifierType identifierType ;
76-
94+
95+ @ ManyToOne
96+ @ JoinColumn (name = "location_id" )
7797 private Location location ;
7898
99+ @ ManyToOne
100+ @ JoinColumn (name = "patient_program_id" )
79101 private PatientProgram patientProgram ;
80102
103+ @ Column (name = "preferred" , nullable = false )
81104 @ GenericField
82105 private Boolean preferred = false ;
83106
0 commit comments