diff --git a/api/src/main/java/org/openmrs/ConceptStopWord.java b/api/src/main/java/org/openmrs/ConceptStopWord.java index d49508ac988..6ce7dfa199f 100644 --- a/api/src/main/java/org/openmrs/ConceptStopWord.java +++ b/api/src/main/java/org/openmrs/ConceptStopWord.java @@ -9,8 +9,21 @@ */ package org.openmrs; +import javax.persistence.AttributeOverride; +import javax.persistence.AttributeOverrides; +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 java.util.Locale; +import org.hibernate.annotations.BatchSize; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; import org.hibernate.envers.Audited; import org.openmrs.api.context.Context; import org.springframework.util.StringUtils; @@ -22,16 +35,33 @@ * * @since 1.8 */ +@Entity +@Table(name = "concept_stop_word") +@BatchSize(size = 25) +@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) +@AttributeOverrides(value = { + @AttributeOverride(name = "uuid", column = @Column(name = "uuid", length = 38, unique = true)) +}) @Audited public class ConceptStopWord extends BaseOpenmrsObject { private static final long serialVersionUID = 3671020002642184656L; // Fields + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "concept_stop_word_concept_stop_word_id_seq") + @GenericGenerator( + name = "concept_stop_word_concept_stop_word_id_seq", + strategy = "native", + parameters = @Parameter(name = "sequence", value = "concept_stop_word_concept_stop_word_id_seq") + ) + @Column(name = "concept_stop_word_id") private Integer conceptStopWordId; + @Column(name = "word", length = 50, nullable = false) private String value; + @Column(name = "locale", length = 20, nullable = false) private Locale locale; // Constructors diff --git a/api/src/main/resources/hibernate.cfg.xml b/api/src/main/resources/hibernate.cfg.xml index 2bd3c6ad8dc..73a88f5d7bd 100644 --- a/api/src/main/resources/hibernate.cfg.xml +++ b/api/src/main/resources/hibernate.cfg.xml @@ -36,7 +36,6 @@ - diff --git a/api/src/main/resources/org/openmrs/api/db/hibernate/ConceptStopWord.hbm.xml b/api/src/main/resources/org/openmrs/api/db/hibernate/ConceptStopWord.hbm.xml deleted file mode 100644 index 10577889bc0..00000000000 --- a/api/src/main/resources/org/openmrs/api/db/hibernate/ConceptStopWord.hbm.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - concept_stop_word_concept_stop_word_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..627d911f238 100644 --- a/api/src/test/java/org/openmrs/api/OrderServiceTest.java +++ b/api/src/test/java/org/openmrs/api/OrderServiceTest.java @@ -29,6 +29,7 @@ import org.openmrs.ConceptMapType; import org.openmrs.ConceptName; import org.openmrs.ConceptReferenceTerm; +import org.openmrs.ConceptStopWord; import org.openmrs.Condition; import org.openmrs.Diagnosis; import org.openmrs.Drug; @@ -2737,6 +2738,7 @@ public void saveOrder_shouldFailIfTheJavaTypeOfThePreviousOrderDoesNotMatch() th .addAnnotatedClass(DrugIngredient.class) .addAnnotatedClass(AlertRecipient.class) .addAnnotatedClass(PatientIdentifierType.class) + .addAnnotatedClass(ConceptStopWord.class) .addAnnotatedClass(ProgramAttributeType.class) .addAnnotatedClass(HL7InError.class) .addAnnotatedClass(OrderType.class)