Newer
Older
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap
PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<cacheModel id="cvterm-cache" type ="LRU" readOnly="true">
<flushInterval hours="24"/>
<property name="cache-size" value="100" />
</cacheModel>
<resultMap id="select-cvterm-names-result" class="CvTerm">
<result property="cvTermId" column="cvterm_id"/>
<result property="cv.cvId" column="cv_id"/>
<result property="cv.name" column="cv_name"/>
<result property="name" column="name"/>
<result property="definition" column="definition"/>
<result property="dbXRef" column="dbxref_id" select="getDbXRefByDbXRefId"/>
<result property="isObsolete" column="is_obsolete"/>
<result property="isRelationshipType" column="is_relationshiptype"/>
<resultMap id="lazy-cvterm" class="CvTerm">
<result property="cvTermId" column="cvterm_id"/>
<result property="name" column="name"/>
<result property="definition" column="definition"/>
<result property="dbXRef" column="dbxref_id" select="getDbXRefByDbXRefId"/>
<result property="isRelationshipType" column="is_relationshiptype"/>
<!-- look up cvterms names and id -->
<select id="getCvterm" resultMap="select-cvterm-names-result">
SELECT
<isNotNull property="cvTermId">
<isGreaterThan property="cvTermId" compareValue="0">
cvterm_id=$cvTermId$ AND
</isGreaterThan>
</isNotNull>
</dynamic>
<select id="getCvtermByCvTermId"
<!-- WRITE BACK -->
<insert id="insertCvTerm" parameterClass="CvTerm">
INSERT INTO cvterm ( cv_id, name <isNotNull property="definition">, definition</isNotNull>, dbxref_id )
VALUES ($cv.cvId$, #name# <isNotNull property="definition"> ,#definition# </isNotNull>, $dbXRef.dbXRefId$)
</insert>