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-5833 : ConceptDescription Domain - Switching from Hibernate Mappings to Annotations #4861

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
32 changes: 32 additions & 0 deletions api/src/main/java/org/openmrs/ConceptDescription.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,62 @@

import java.util.Date;
import java.util.Locale;
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;
import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
* ConceptDescription is the localized description of a concept.
*/
@Entity
@Table(name = "concept_description")
@BatchSize(size = 10)
@Audited
public class ConceptDescription extends BaseOpenmrsObject implements Auditable, java.io.Serializable {

private static final long serialVersionUID = -7223075113369136584L;

// Fields
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "concept_description_id_seq")
@GenericGenerator(
name = "concept_description_id_seq",
strategy = "native",
parameters = @Parameter(name = "sequence", value = "concept_description_concept_description_id_seq")
)
@Column(name = "concept_description_id", nullable = false)
private Integer conceptDescriptionId;

@ManyToOne
@JoinColumn(name = "concept_id", nullable = false)
private Concept concept;

@Column(name = "description", length = 65535, nullable = false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wikumChamith do we need to change description type from text to Varchar ?

private String description;

@Column(name = "locale", length = 50, nullable = false)
private Locale locale;

@ManyToOne
@JoinColumn(name = "creator", nullable = false)
private User creator;

@Column(name = "date_created", nullable = false)
private Date dateCreated;

@ManyToOne
@JoinColumn(name = "changed_by", nullable = true)
private User changedBy;

@Column(name = "date_changed", nullable = true)
private Date dateChanged;

// 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 @@ -27,7 +27,6 @@
<mapping resource="org/openmrs/api/db/hibernate/ConceptAnswer.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/ConceptAttribute.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/ConceptAttributeType.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/ConceptDescription.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/ConceptName.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/ConceptNameTag.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/ConceptClass.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 @@ -2740,6 +2740,7 @@ public void saveOrder_shouldFailIfTheJavaTypeOfThePreviousOrderDoesNotMatch() th
.addAnnotatedClass(ProgramAttributeType.class)
.addAnnotatedClass(HL7InError.class)
.addAnnotatedClass(OrderType.class)
.addAnnotatedClass(ConceptDescription.class)
.getMetadataBuilder().build();


Expand Down