...
Modules must add hibernate.hbm.xml files to their /metadata file AND reference them in their config.xml files in the <mappingFiles> element.
[edit]
Example Java Object
Code Block |
---|
package org.openmrs;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.Locale;
/**
* ConceptName is the real world term used to express a Concept within the idiom of a particular
* locale.
*/
public class ConceptName extends BaseOpenmrsObject implements Auditable {
// Fields
private Integer conceptNameId;
private Concept concept;
private String name;
private Locale locale;
private Collection<ConceptNameTag> tags;
// Constructors
/** default constructor */
public ConceptName() {
}
/**
* Convenience constructor to create a ConceptName object by primary key
*
* @param conceptNameId
*/
public ConceptName(Integer conceptNameId) {
this.conceptNameId = conceptNameId;
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
if (!(obj instanceof ConceptName)) {
return false;
}
ConceptName rhs = (ConceptName) obj;
if (this.conceptNameId != null && rhs.conceptNameId != null)
return (this.conceptNameId.equals(rhs.conceptNameId));
else
return this == obj;
}
/**
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
if (this.getConceptNameId() == null)
return super.hashCode();
int hash = 3;
hash = hash + 31 * this.getConceptNameId();
return hash;
}
public Integer getConceptNameId() {
return conceptNameId;
}
public void setConceptNameId(Integer conceptNameId) {
this.conceptNameId = conceptNameId;
}
public Concept getConcept() {
return concept;
}
public void setConcept(Concept concept) {
this.concept = concept;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Locale getLocale() {
return locale;
}
public void setLocale(Locale locale) {
this.locale = locale;
}
public Collection<ConceptNameTag> getTags() {
return tags;
}
public void setTags(Collection<ConceptNameTag> tags) {
this.tags = tags;
}
}
|
[edit]
Hibernate Mapping File
...
Some attributes defined here (like uuid, creator, voided, etc.) are defined on the parent class of ConceptName.
...