Skip to content
Snippets Groups Projects
PubDbXRef.xml 1.4 KiB
Newer Older
  • Learn to ignore specific revisions
  • tjc's avatar
    tjc committed
    <?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"> 
     
    
    <sqlMap namespace="PubDbXRef"> 
    
        <typeAlias alias="PubDbXRef"
            type="org.gmod.schema.pub.PubDbXRef"/>
    
      <resultMap id="select-pubdbxref" class="PubDbXRef">
        <result property="pub.pubId"   column="pub_id" />
        <result property="dbXRef.accession"   column="accession" />
        <result property="dbXRef.version"     column="version" />
        <result property="dbXRef.description" column="dbx_description" />
        <result property="dbXRef.db.name"     column="name" />
        <result property="dbXRef.db.description" column="description" />
        <result property="dbXRef.db.urlPrefix" column="urlprefix" />
        <result property="dbXRef.db.url" column="url" />
      </resultMap>
      
      <!-- SQL -->
     
      <select id="getPubDbXRef" resultMap="select-pubdbxref">
       select pub_id, pub_dbxref.dbxref_id, 
           accession, version, dbx.description AS dbx_description, 
           db.name, db.description, db.urlprefix, db.url FROM pub_dbxref 
           LEFT JOIN dbxref dbx ON pub_dbxref.dbxref_id=dbx.dbxref_id 
           LEFT JOIN db ON db.db_id=dbx.db_id 
      </select>
        
      <!-- WRITE BACK -->
      <insert id="insertPubDbXRef" parameterClass="PubDbXRef">
        INSERT INTO pub_dbxref ( pub_id, dbxref_id ) 
        VALUES ( $pub.pubId$, $dbXRef.dbXRefId$ )
      </insert> 
    </sqlMap>