Skip to content
Snippets Groups Projects
Commit e0c61f9e authored by tjc's avatar tjc
Browse files

ibatis config

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@3802 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent d34f4a27
No related branches found
No related tags found
No related merge requests found
<?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="Cvterm">
<resultMap id="select-cvterm-names-result" class="uk.ac.sanger.ibatis.Cvterm">
<result property="id" column="cvterm_id"/>
<result property="name" column="name"/>
</resultMap>
<!-- look up cvterms names and id -->
<select id="getCvterm" resultMap="select-cvterm-names-result">
SELECT
cvterm.CVTERM_ID, cvterm.NAME
FROM cvterm, cv WHERE cv.cv_id = cvterm.cv_id
</select>
</sqlMap>
<?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="Feature">
<resultMap id="select-feature-properties-result" class="uk.ac.sanger.ibatis.Feature">
<result property="timelastmodified" column="timelastmodified"/>
<result property="id" column="id"/>
<result property="object_id" column="object_id"/>
<result property="strand" column="strand"/>
<result property="fmin" column="fmin"/>
<result property="fmax" column="fmax"/>
<result property="uniquename" column="uniquename"/>
<result property="type_id" column="type_id"/>
<result property="prop_type_id" column="prop_type_id"/>
<result property="value" column="value"/>
</resultMap>
<resultMap id="select-feature-sequence-result" class="uk.ac.sanger.ibatis.Feature">
<result property="name" column="name"/>
<result property="residues" column="residues"/>
</resultMap>
<resultMap id="select-feature-with-residues-result" class="uk.ac.sanger.ibatis.Feature">
<result property="abbreviation" column="abbreviation"/>
<result property="name" column="name"/>
<result property="id" column="feature_id"/>
<result property="type_id" column="type_id"/>
</resultMap>
<!-- get feature name -->
<select id="getFeatureName" parameterClass="java.lang.String" resultClass="java.lang.String">
SELECT
name
FROM feature WHERE feature_id=#value#
</select>
<select id="getGffLine" parameterClass="int" resultMap="select-feature-properties-result">
SELECT
timelastmodified,
feature.feature_id AS id,
object_id,
strand,
fmin,
fmax,
uniquename,
feature.type_id AS type_id,
featureprop.type_id AS prop_type_id,
featureprop.value AS value
FROM featureloc, feature
LEFT JOIN feature_relationship ON feature_relationship.subject_id=feature.feature_id
LEFT JOIN featureprop ON featureprop.feature_id=feature.feature_id
WHERE srcfeature_id=#value# and featureloc.feature_id=feature.feature_id
and (featureloc.rank=feature_relationship.rank OR feature_relationship.rank IS NULL)
ORDER BY feature.type_id, uniquename
</select>
<select id="getSequence" parameterClass="int" resultMap="select-feature-sequence-result">
SELECT
name,
residues
FROM feature
WHERE feature_id=#value#
</select>
<select id="getResidueType" resultClass="java.lang.String">
SELECT DISTINCT type_id FROM feature WHERE residues notnull
</select>
<select id="getResidueFeatures" parameterClass="java.util.List" resultMap="select-feature-with-residues-result">
SELECT
abbreviation,
name,
feature_id,
type_id
FROM organism, feature WHERE
organism.organism_id=feature.organism_id AND
residues notnull
<iterate prepend="AND" conjunction="OR" open="(" close=")">
type_id=#[]#
</iterate>
ORDER BY abbreviation
</select>
</sqlMap>
<?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="Organism">
<!-- Use primitive wrapper type (e.g. Integer) as parameter and allow results to
be auto-mapped results to Organism object (JavaBean) properties -->
<select id="getOrganism" parameterClass="java.lang.String" resultClass="uk.ac.sanger.ibatis.Organism">
SELECT
ORGANISM_ID as id,
ABBREVIATION,
GENUS,
SPECIES,
COMMON_NAME,
COMMENT
FROM Organism WHERE COMMON_NAME = #value#
</select>
</sqlMap>
# This is just a simple properties file that simplifies automated configuration
# of the SQL Maps configuration file (e.g. by Ant builds or continuous
# integration tools for different environments... etc.)
# These values can be used in any property value in the file above (e.g. ${driver})
# Using a properties file such as this is completely optional.
driver=org.postgresql.Driver
url=jdbc:postgresql://localhost:2999/test
username=tjc
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<!-- Always ensure to use the correct XML header as above! -->
<sqlMapConfig>
<!-- The properties (name=value) in the file specified here can be used placeholders in this config
file (e.g. ${driver}. The file is usually relative to the classpath and is optional. -->
<!--
<properties resource="artemis_sqlmap/chado_iBatis_config.properties" />
-->
<!-- These settings control SqlMap configuration details, primarily to do with transaction
management. They are all optional (see the Developer Guide for more). -->
<settings
cacheModelsEnabled="true"
enhancementEnabled="true"
lazyLoadingEnabled="true"
maxRequests="32"
maxSessions="10"
maxTransactions="5"
useStatementNamespaces="false"
/>
<!-- Type aliases allow you to use a shorter name for long fully qualified class names. -->
<typeAlias alias="order" type="testdomain.Order"/>
<!-- Configure a datasource to use with this SQL Map using SimpleDataSource.
Notice the use of the properties from the above resource -->
<transactionManager type="JDBC" >
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="org.postgresql.Driver"/>
<property name="JDBC.ConnectionURL" value="jdbc:postgresql://${chado}"/>
<property name="JDBC.Username" value="${username}"/>
<property name="JDBC.Password" value="${password}"/>
</dataSource>
</transactionManager>
<!-- Identify all SQL Map XML files to be loaded by this SQL map. Notice the paths
are relative to the classpath. For now, we only have one... -->
<sqlMap resource="artemis_sqlmap/Organism.xml" />
<sqlMap resource="artemis_sqlmap/Cvterm.xml" />
<sqlMap resource="artemis_sqlmap/Feature.xml" />
</sqlMapConfig>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment