Skip to content

Commit 8730c7e

Browse files
pidsonndkayiwa
andauthored
TRUNK-5833: Switch ConceptDescription domain from Hibernate mapping t… (#5456)
* TRUNK-5833: Switch ConceptDescription domain from Hibernate mapping to annotations * TRUNK-5833: Set concept_description_id as non-nullable --------- Co-authored-by: dkayiwa <[email protected]>
1 parent 051f018 commit 8730c7e

File tree

4 files changed

+32
-51
lines changed

4 files changed

+32
-51
lines changed

api/src/main/java/org/openmrs/ConceptDescription.java

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
*/
1010
package org.openmrs;
1111

12+
import jakarta.persistence.Column;
13+
import jakarta.persistence.Entity;
14+
import jakarta.persistence.GeneratedValue;
15+
import jakarta.persistence.GenerationType;
16+
import jakarta.persistence.Id;
17+
import jakarta.persistence.JoinColumn;
18+
import jakarta.persistence.ManyToOne;
19+
import jakarta.persistence.Table;
1220
import org.hibernate.envers.Audited;
1321

1422
import java.util.Date;
@@ -18,25 +26,40 @@
1826
* ConceptDescription is the localized description of a concept.
1927
*/
2028
@Audited
29+
@Entity
30+
@Table(name = "concept_description")
2131
public class ConceptDescription extends BaseOpenmrsObject implements Auditable, java.io.Serializable {
2232

2333
private static final long serialVersionUID = -7223075113369136584L;
2434

2535
// Fields
36+
@Id
37+
@GeneratedValue(strategy = GenerationType.IDENTITY)
38+
@Column(name = "concept_description_id", nullable = false)
2639
private Integer conceptDescriptionId;
27-
40+
41+
@ManyToOne(optional = false)
42+
@JoinColumn(name = "concept_id", nullable = false)
2843
private Concept concept;
29-
44+
45+
@Column(name = "description", nullable = false, length = 65535, columnDefinition = "text")
3046
private String description;
31-
47+
48+
@Column(name = "locale", nullable = false, length = 50)
3249
private Locale locale;
33-
50+
51+
@ManyToOne(optional = false)
52+
@JoinColumn(name = "creator", nullable = false)
3453
private User creator;
35-
54+
55+
@Column(name = "date_created", nullable = false)
3656
private Date dateCreated;
37-
57+
58+
@ManyToOne
59+
@JoinColumn(name = "changed_by")
3860
private User changedBy;
39-
61+
62+
@Column(name = "date_changed")
4063
private Date dateChanged;
4164

4265
// Constructors

api/src/main/resources/hibernate.cfg.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
<!-- API -->
2323
<mapping resource="org/openmrs/api/db/hibernate/Concept.hbm.xml" />
2424
<mapping resource="org/openmrs/api/db/hibernate/ConceptAttribute.hbm.xml" />
25-
<mapping resource="org/openmrs/api/db/hibernate/ConceptDescription.hbm.xml" />
2625
<mapping resource="org/openmrs/api/db/hibernate/ConceptName.hbm.xml" />
2726
<mapping resource="org/openmrs/api/db/hibernate/ConceptProposal.hbm.xml" />
2827
<mapping resource="org/openmrs/api/db/hibernate/ConceptSet.hbm.xml" />

api/src/main/resources/org/openmrs/api/db/hibernate/ConceptDescription.hbm.xml

Lines changed: 0 additions & 42 deletions
This file was deleted.

api/src/test/java/org/openmrs/api/OrderServiceTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2911,7 +2911,8 @@ public void saveOrder_shouldFailIfTheJavaTypeOfThePreviousOrderDoesNotMatch() th
29112911
.addAnnotatedClass(ConceptReferenceTermMap.class)
29122912
.addAnnotatedClass(ConceptReferenceTerm.class)
29132913
.addAnnotatedClass(ConceptAnswer.class)
2914-
.addAnnotatedClass(ConceptClass.class)
2914+
.addAnnotatedClass(ConceptDescription.class)
2915+
.addAnnotatedClass(ConceptClass.class)
29152916
.addAnnotatedClass(ConceptMap.class)
29162917
.addAnnotatedClass(FormResource.class)
29172918
.addAnnotatedClass(VisitType.class)

0 commit comments

Comments
 (0)