Skip to content

Commit

Permalink
TRUNK-5906 : ConceptReferenceTerm Domain - Switching from Hibernate M…
Browse files Browse the repository at this point in the history
…appings to Annotations
  • Loading branch information
rishabhrawat05 committed Feb 1, 2025
1 parent 636538f commit c58e938
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 64 deletions.
25 changes: 24 additions & 1 deletion api/src/main/java/org/openmrs/ConceptReferenceTerm.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,20 @@

import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.Entity;
import org.hibernate.envers.Audited;
import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import javax.persistence.Table;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import javax.persistence.OneToMany;

/**
* A concept reference term is typically name for a concept by which it is referred in another
Expand All @@ -25,21 +34,35 @@
* @since 1.9
*/
@Audited
@Entity
@Table(name = "concept_reference_term")
public class ConceptReferenceTerm extends BaseChangeableOpenmrsMetadata {

private static final long serialVersionUID = 1L;

@DocumentId
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@GenericGenerator(
name = "concept_reference_term_id_seq",
strategy = "native",
parameters = @Parameter(name = "sequence", value = "concept_reference_term_concept_reference_term_id_seq")
)
@Column(name = "concept_reference_term_id")
private Integer conceptReferenceTermId;

@Column(name = "concept_source_id", nullable = false)
private ConceptSource conceptSource;

//The unique code used to identify the reference term in it's reference terminology
@Field(analyze = Analyze.NO)
@Column(name = "code", length = 255, nullable = false)
private String code;

@Column(name = "version", length = 50)
private String version;

@OneToMany(mappedBy = "conceptReferenceTerm" ,cascade = CascadeType.ALL, orphanRemoval = true)
private Set<ConceptReferenceTermMap> conceptReferenceTermMaps;

/** default constructor */
Expand Down
1 change: 0 additions & 1 deletion api/src/main/resources/hibernate.cfg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
<mapping resource="org/openmrs/api/db/hibernate/ConceptMap.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/ConceptStopWord.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/ConceptSource.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/ConceptReferenceTerm.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/ConceptReferenceTermMap.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/DiagnosisAttribute.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/DiagnosisAttributeType.hbm.xml" />
Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions api/src/test/java/org/openmrs/api/OrderServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2742,6 +2742,7 @@ public void saveOrder_shouldFailIfTheJavaTypeOfThePreviousOrderDoesNotMatch() th
.addAnnotatedClass(ProgramAttributeType.class)
.addAnnotatedClass(HL7InError.class)
.addAnnotatedClass(OrderType.class)
.addAnnotatedClass(ConceptReferenceTerm.class)
.getMetadataBuilder().build();


Expand Down

0 comments on commit c58e938

Please sign in to comment.