diff --git a/api/src/main/java/org/openmrs/ConceptDatatype.java b/api/src/main/java/org/openmrs/ConceptDatatype.java
index bb891a213cd..7fa7c95db4a 100644
--- a/api/src/main/java/org/openmrs/ConceptDatatype.java
+++ b/api/src/main/java/org/openmrs/ConceptDatatype.java
@@ -9,12 +9,25 @@
*/
package org.openmrs;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import org.hibernate.annotations.Parameter;
import org.hibernate.envers.Audited;
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+import org.hibernate.annotations.GenericGenerator;
import org.hibernate.search.annotations.DocumentId;
/**
* ConceptDatatype
*/
+@Entity
+@Table(name = "concept_datatype")
+@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
@Audited
public class ConceptDatatype extends BaseChangeableOpenmrsMetadata {
@@ -66,8 +79,17 @@ public class ConceptDatatype extends BaseChangeableOpenmrsMetadata {
// Fields
@DocumentId
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "concept_datatype_id_seq")
+ @GenericGenerator(
+ name = "concept_datatype_id_seq",
+ strategy = "native",
+ parameters = @Parameter(name = "sequence", value = "concept_datatype_concept_datatype_id_seq")
+ )
+ @Column(name = "concept_datatype_id")
private Integer conceptDatatypeId;
+ @Column(name = "hl7_abbreviation", length = 3, nullable = true)
private String hl7Abbreviation;
// Constructors
diff --git a/api/src/main/resources/hibernate.cfg.xml b/api/src/main/resources/hibernate.cfg.xml
index 2bd3c6ad8dc..f3249a90d70 100644
--- a/api/src/main/resources/hibernate.cfg.xml
+++ b/api/src/main/resources/hibernate.cfg.xml
@@ -31,7 +31,6 @@
-
@@ -60,8 +59,8 @@
-
-
+
+
diff --git a/api/src/main/resources/org/openmrs/api/db/hibernate/ConceptDatatype.hbm.xml b/api/src/main/resources/org/openmrs/api/db/hibernate/ConceptDatatype.hbm.xml
deleted file mode 100644
index 7fab8cb0316..00000000000
--- a/api/src/main/resources/org/openmrs/api/db/hibernate/ConceptDatatype.hbm.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- concept_datatype_concept_datatype_id_seq
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/api/src/test/java/org/openmrs/api/OrderServiceTest.java b/api/src/test/java/org/openmrs/api/OrderServiceTest.java
index 6d553c03825..1b41f04549b 100644
--- a/api/src/test/java/org/openmrs/api/OrderServiceTest.java
+++ b/api/src/test/java/org/openmrs/api/OrderServiceTest.java
@@ -2719,10 +2719,14 @@ public void saveOrder_shouldFailIfTheJavaTypeOfThePreviousOrderDoesNotMatch() th
StandardServiceRegistry standardRegistry = new StandardServiceRegistryBuilder()
.configure().applySettings(configuration.getProperties()).build();
- Metadata metaData = new MetadataSources(standardRegistry).addAnnotatedClass(Allergy.class)
- .addAnnotatedClass(Encounter.class).addAnnotatedClass(SomeTestOrder.class)
- .addAnnotatedClass(Diagnosis.class).addAnnotatedClass(Condition.class)
- .addAnnotatedClass(Visit.class).addAnnotatedClass(VisitAttributeType.class)
+ Metadata metaData = new MetadataSources(standardRegistry)
+ .addAnnotatedClass(Allergy.class)
+ .addAnnotatedClass(Encounter.class)
+ .addAnnotatedClass(SomeTestOrder.class)
+ .addAnnotatedClass(Diagnosis.class)
+ .addAnnotatedClass(Condition.class)
+ .addAnnotatedClass(Visit.class)
+ .addAnnotatedClass(VisitAttributeType.class)
.addAnnotatedClass(MedicationDispense.class)
.addAnnotatedClass(ProviderAttributeType.class)
.addAnnotatedClass(ConceptMapType.class)
@@ -2740,6 +2744,7 @@ public void saveOrder_shouldFailIfTheJavaTypeOfThePreviousOrderDoesNotMatch() th
.addAnnotatedClass(ProgramAttributeType.class)
.addAnnotatedClass(HL7InError.class)
.addAnnotatedClass(OrderType.class)
+ .addAnnotatedClass(ConceptDatatype.class)
.getMetadataBuilder().build();