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

use iBatis transactions

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@4635 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent 54c2f305
No related branches found
No related tags found
No related merge requests found
......@@ -116,7 +116,7 @@ public class DatabaseDocument extends Document
*
* @param location
* This should be a URL string giving:
* jdbc:postgresql://host:port/datbase_name?user=username
* jdbc:postgresql://host:port/database_name?user=username
* @param feature_id
* ID of a feature to be extracted.
*
......@@ -291,20 +291,25 @@ public class DatabaseDocument extends Document
try
{
ChadoDAO dao = getDAO();
ByteBuffer entry = new ByteBuffer();
try
{
if(dao instanceof IBatisDAO)
((IBatisDAO) dao).startTransaction();
// if creating a gene builder
if(gene_builder)
{
List schemaList = new Vector();
schemaList.add(schema);
return new ByteArrayInputStream(
getGeneFeature(feature_id, schemaList, dao).getBytes());
return new ByteArrayInputStream(getGeneFeature(feature_id,
schemaList, dao).getBytes());
}
gff_buffer = getGff(dao, feature_id);
ByteBuffer entry = new ByteBuffer();
if(splitGFFEntry)
{
if(gff_buffer[0].size() > 0)
......@@ -323,6 +328,15 @@ public class DatabaseDocument extends Document
getChadoSequence(dao, entry);
}
if(dao instanceof IBatisDAO)
((IBatisDAO) dao).commitTransaction();
}
finally
{
if(dao instanceof IBatisDAO)
((IBatisDAO) dao).endTransaction();
}
instream = new ByteArrayInputStream(entry.getBytes());
return instream;
}
......@@ -707,9 +721,14 @@ public class DatabaseDocument extends Document
for(int j=0; j<v_synonyms.size(); j++)
{
alias = (ChadoFeatureSynonym)v_synonyms.get(j);
this_buff.append(alias.getSynonym().getCvterm().getName()+"=");
this_buff.append( getCvtermName(alias.getSynonym().getCvterm().getCvtermId(), dao) + "=" );
//this_buff.append(alias.getSynonym().getCvterm().getName()+"=");
this_buff.append(alias.getSynonym().getName());
//System.out.println(getCvtermName(alias.getSynonym().getCvterm().getCvtermId(), dao)+" "+
// alias.getSynonym().getCvterm().getName());
if(j<v_synonyms.size()-1)
this_buff.append(";");
}
......@@ -845,6 +864,9 @@ public class DatabaseDocument extends Document
try
{
if(dao instanceof IBatisDAO)
((IBatisDAO) dao).startTransaction();
schema_list = dao.getSchema();
Iterator it = schema_list.iterator();
......@@ -869,6 +891,9 @@ public class DatabaseDocument extends Document
}
}
if(dao instanceof IBatisDAO)
((IBatisDAO) dao).commitTransaction();
}
catch(java.sql.SQLException sqlExp)
{
......@@ -878,6 +903,12 @@ public class DatabaseDocument extends Document
JOptionPane.ERROR_MESSAGE);
sqlExp.printStackTrace();
}
finally
{
if(dao instanceof IBatisDAO)
((IBatisDAO) dao).endTransaction();
}
return db;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment