diff --git a/api/src/main/java/org/openmrs/CareSetting.java b/api/src/main/java/org/openmrs/CareSetting.java
index 145a753cbeb..68aa178e6d1 100644
--- a/api/src/main/java/org/openmrs/CareSetting.java
+++ b/api/src/main/java/org/openmrs/CareSetting.java
@@ -9,8 +9,19 @@
*/
package org.openmrs;
+import org.hibernate.annotations.GenericGenerator;
+import org.hibernate.annotations.Parameter;
import org.hibernate.envers.Audited;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
/**
* Care Setting defines the scope of care for any piece of data within the medical record. Clinical
* data (treatments, notes, etc.) apply within their associated care setting. Implementations
@@ -26,6 +37,8 @@
*
* @since 1.10
*/
+@Entity
+@Table(name = "care_setting")
@Audited
public class CareSetting extends BaseChangeableOpenmrsMetadata {
@@ -33,9 +46,19 @@ public enum CareSettingType {
OUTPATIENT,
INPATIENT
}
-
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "care_setting_id_seq")
+ @GenericGenerator(
+ name = "care_setting_id_seq",
+ strategy = "native",
+ parameters = @Parameter(name = "sequence", value = "care_setting_care_setting_id_seq")
+ )
+ @Column(name = "care_setting_id")
private Integer careSettingId;
-
+
+ @Enumerated(EnumType.STRING)
+ @Column(name = "care_setting_type", nullable = false, length = 50)
private CareSettingType careSettingType;
public CareSetting() {
diff --git a/api/src/main/resources/hibernate.cfg.xml b/api/src/main/resources/hibernate.cfg.xml
index 2bd3c6ad8dc..9849df43813 100644
--- a/api/src/main/resources/hibernate.cfg.xml
+++ b/api/src/main/resources/hibernate.cfg.xml
@@ -73,7 +73,6 @@
-
diff --git a/api/src/main/resources/org/openmrs/api/db/hibernate/CareSetting.hbm.xml b/api/src/main/resources/org/openmrs/api/db/hibernate/CareSetting.hbm.xml
deleted file mode 100644
index 755c8d93772..00000000000
--- a/api/src/main/resources/org/openmrs/api/db/hibernate/CareSetting.hbm.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
-
-
-
-
-
- care_setting_care_setting_id_seq
-
-
-
-
-
- org.openmrs.CareSetting$CareSettingType
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/api/src/test/java/org/openmrs/api/OrderServiceTest.java b/api/src/test/java/org/openmrs/api/OrderServiceTest.java
index 6d553c03825..ad487966879 100644
--- a/api/src/test/java/org/openmrs/api/OrderServiceTest.java
+++ b/api/src/test/java/org/openmrs/api/OrderServiceTest.java
@@ -2740,6 +2740,7 @@ public void saveOrder_shouldFailIfTheJavaTypeOfThePreviousOrderDoesNotMatch() th
.addAnnotatedClass(ProgramAttributeType.class)
.addAnnotatedClass(HL7InError.class)
.addAnnotatedClass(OrderType.class)
+ .addAnnotatedClass(CareSetting.class)
.getMetadataBuilder().build();