diff --git a/api/src/main/java/org/openmrs/BaseOpenmrsMetadata.java b/api/src/main/java/org/openmrs/BaseOpenmrsMetadata.java
index 664379ecb89..482e34bb3df 100644
--- a/api/src/main/java/org/openmrs/BaseOpenmrsMetadata.java
+++ b/api/src/main/java/org/openmrs/BaseOpenmrsMetadata.java
@@ -38,7 +38,7 @@ public abstract class BaseOpenmrsMetadata extends BaseOpenmrsObject implements O
@Field
private String name;
- @Column(name = "description", length = 255)
+ @Column(name = "description", columnDefinition = "clob")
private String description;
@ManyToOne(optional = false)
diff --git a/api/src/main/java/org/openmrs/PatientIdentifierType.java b/api/src/main/java/org/openmrs/PatientIdentifierType.java
index 600530bba2b..f54e26e12aa 100644
--- a/api/src/main/java/org/openmrs/PatientIdentifierType.java
+++ b/api/src/main/java/org/openmrs/PatientIdentifierType.java
@@ -10,14 +10,30 @@
package org.openmrs;
import org.apache.commons.lang3.StringUtils;
+import org.hibernate.annotations.GenericGenerator;
import org.hibernate.envers.Audited;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
+import javax.persistence.AttributeOverride;
+import javax.persistence.AttributeOverrides;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
/**
* PatientIdentifierType
*/
+@Entity
+@Table(name = "patient_identifier_type")
@Audited
+@AttributeOverrides({
+ @AttributeOverride(name = "name", column = @Column(name = "name", nullable = false, length = 50))
+})
public class PatientIdentifierType extends BaseChangeableOpenmrsMetadata {
public static final long serialVersionUID = 211231L;
@@ -61,19 +77,31 @@ public enum UniquenessBehavior {
// Fields
@DocumentId
+ @Id
+ @GeneratedValue(generator = "native")
+ @GenericGenerator(name = "native", strategy = "native")
+ @Column(name = "patient_identifier_type_id")
private Integer patientIdentifierTypeId;
-
+
+ @Column(name = "format")
private String format;
@Field
+ @Column(name = "required", nullable = false)
private Boolean required = Boolean.FALSE;
-
+
+ @Column(name = "format_description", length = 250)
private String formatDescription;
+ @Column(name = "validator", length = 200)
private String validator;
-
+
+ @Enumerated(EnumType.STRING)
+ @Column(name = "location_behavior", length = 50)
private LocationBehavior locationBehavior;
-
+
+ @Enumerated(EnumType.STRING)
+ @Column(name = "uniqueness_behavior", length = 50)
private UniquenessBehavior uniquenessBehavior;
/** default constructor */
diff --git a/api/src/main/resources/hibernate.cfg.xml b/api/src/main/resources/hibernate.cfg.xml
index 85402c4b68d..60ccdf2099b 100644
--- a/api/src/main/resources/hibernate.cfg.xml
+++ b/api/src/main/resources/hibernate.cfg.xml
@@ -60,7 +60,6 @@
-
diff --git a/api/src/main/resources/org/openmrs/api/db/hibernate/PatientIdentifierType.hbm.xml b/api/src/main/resources/org/openmrs/api/db/hibernate/PatientIdentifierType.hbm.xml
deleted file mode 100644
index 611cc5ab307..00000000000
--- a/api/src/main/resources/org/openmrs/api/db/hibernate/PatientIdentifierType.hbm.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-
-
-
-
-
-
-
-
-
- patient_identifier_type_patient_identifier_type_id_seq
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.openmrs.PatientIdentifierType$LocationBehavior
- true
-
-
-
-
-
- org.openmrs.PatientIdentifierType$UniquenessBehavior
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/api/src/test/java/org/openmrs/api/OrderServiceTest.java b/api/src/test/java/org/openmrs/api/OrderServiceTest.java
index 207b7c2cbed..e47ce608ad4 100644
--- a/api/src/test/java/org/openmrs/api/OrderServiceTest.java
+++ b/api/src/test/java/org/openmrs/api/OrderServiceTest.java
@@ -52,6 +52,7 @@
import org.openmrs.OrderSet;
import org.openmrs.OrderType;
import org.openmrs.Patient;
+import org.openmrs.PatientIdentifierType;
import org.openmrs.PatientState;
import org.openmrs.PersonAddress;
import org.openmrs.PersonAttributeType;
@@ -2733,6 +2734,7 @@ public void saveOrder_shouldFailIfTheJavaTypeOfThePreviousOrderDoesNotMatch() th
.addAnnotatedClass(PatientState.class)
.addAnnotatedClass(DrugIngredient.class)
.addAnnotatedClass(AlertRecipient.class)
+ .addAnnotatedClass(PatientIdentifierType.class)
.getMetadataBuilder().build();