Wiki Spaces

Documentation
Projects
Resources

Get Help from Others

Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack

Documentation

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
firstline1
titleExample Mapping File
linenumberstrue
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="org.openmrs.module.YourJavaClass">
    <class name="YourJavaClass" table="your_mysql_table">
        <id name="id" column="your_mysql_table_id">
            <generator class="native"/>
        </id>
        <property name="sampleInteger"         type="java.lang.Integer"        column="simple_integer"/>
        <property name="sampleString"       type="java.lang.String"         column="sample_string" length="255"/>
        <property name="uuid"           type="java.lang.String"         column="uuid" length="38" not-null="true" unique="true"/>
        <property name="dateCreated"    type="java.util.Date"           column="date_created" length="19" not-null="true"/>
        <many-to-one name="patient"      class="org.openmrs.Patient"     column="author_id" not-null="true"/>
        <one-to-one name="encounter"   class="org.openmrs.Encounter"   column="encounter_id" not-null="true"/>
		<one-to-many name = "provider" class="org.openmrs.Provider" column="provider_id" not-null="true"/>
    </class>
</hibernate-mapping>

...