Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRUNK-5907: ConceptReferenceTermMap Domain - Switching from Hibernate Mappings to Annotations #4897

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions api/src/main/java/org/openmrs/ConceptReferenceTermMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
package org.openmrs;

import org.hibernate.envers.Audited;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
* The concept Reference Term map object represents a mapping between two Concept Reference Terms. A
Expand All @@ -19,14 +29,28 @@
* @since 1.9
*/
@Audited
@Entity
@Table(name = "concept_reference_term_map")
public class ConceptReferenceTermMap extends BaseConceptMap {

private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@GenericGenerator(
name = "concept_reference_term_map_id_seq",
strategy = "native",
parameters = @Parameter(name = "sequence", value = "concept_reference_term_map_concept_reference_term_map_id_seq")
)
@Column(name = "concept_reference_term_map_id", nullable = false)
private Integer conceptReferenceTermMapId;

@ManyToOne
@JoinColumn(name = "term_a_id", nullable = false)
private ConceptReferenceTerm termA;

@ManyToOne
@JoinColumn(name = "term_b_id", nullable = false)
private ConceptReferenceTerm termB;

// Constructors
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 @@ -39,7 +39,6 @@
<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" />
<mapping resource="org/openmrs/api/db/hibernate/Drug.hbm.xml" />
Expand Down

This file was deleted.

2 changes: 2 additions & 0 deletions api/src/test/java/org/openmrs/api/OrderServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.openmrs.ConceptMapType;
import org.openmrs.ConceptName;
import org.openmrs.ConceptReferenceTerm;
import org.openmrs.ConceptReferenceTermMap;
import org.openmrs.Condition;
import org.openmrs.Diagnosis;
import org.openmrs.Drug;
Expand Down Expand Up @@ -2740,6 +2741,7 @@ public void saveOrder_shouldFailIfTheJavaTypeOfThePreviousOrderDoesNotMatch() th
.addAnnotatedClass(ProgramAttributeType.class)
.addAnnotatedClass(HL7InError.class)
.addAnnotatedClass(OrderType.class)
.addAnnotatedClass(ConceptReferenceTermMap.class)
.getMetadataBuilder().build();


Expand Down
Loading