ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ross, Niall" <Niall.R...@agriculture.gov.ie>
Subject RE: Problem committing records using IBATIS in embedded jar file
Date Wed, 13 Dec 2006 16:27:45 GMT
The odd "@ @" syntax is just merely tokens which are substituted for there 
correct values from a properties files. 
 
We are using iBatis version 2.0.9
 
Regards,
Niall
 
Project A 2nd config file  sql-map-config-iforis.xml
 
<sqlMapConfig> 
 <settings cacheModelsEnabled="true" enhancementEnabled="true" maxSessions="50" maxTransactions="50"
maxRequests="300" useStatementNamespaces="true" /> 
 
 <transactionManager type="JDBC" >
  <dataSource type="SIMPLE">
   <property name="JDBC.Driver" value="oracle.jdbc.driver.OracleDriver"/>
   <property name="JDBC.ConnectionURL" value="jdbc:oracle:thin:@10.0.97.70:1522:UAT"/>
   <property name="JDBC.Username" value="SPS_AHCSMIG_CONNECT"/>
   <property name="JDBC.Password" value="SPS_AHCSMIG_CONNECT"/>
   <property name="JDBC.DefaultAutoCommit" value="true" />
   <property name="Pool.MaximumActiveConnections" value="10"/>
   <property name="Pool.MaximumIdleConnections" value="5"/>
   <property name="Pool.MaximumCheckoutTime" value="120000"/>
   <property name="Pool.TimeToWait" value="500"/>
   <property name="Pool.PingQuery" value="select * from TDIF_NOTES"/>
   <property name="Pool.PingEnabled" value="false"/>
   <property name="Pool.PingConnectionsOlderThan" value="1"/>
   <property name="Pool.PingConnectionsNotUsedFor" value="1"/>
  </dataSource>
 </transactionManager>
 
 <sqlMap resource="ie/gov/agriculture/sps/app/dao/xml/IForisData.xml"/>
 
</sqlMapConfig>

-----Original Message-----
From: Brandon Goodin [mailto:brandon.goodin@gmail.com]
Sent: 13 December 2006 16:08
To: user-java@ibatis.apache.org
Subject: Re: Problem committing records using IBATIS in embedded jar file


I see Project A loads two different SQL Map configs with an odd @...@ syntax. You only posted
1 of them for Project A. Please post the other as well. Also, what version of iBATIS are you
using?

Brandon


On 12/13/06, Ross, Niall < Niall.Ross@agriculture.gov.ie> wrote: 

Brandon,
 
Attached are the essential parts of the necessary files.
 
Regards,
Niall
-----------------------------------------------------------------
 
Project A sql-map-config.xml
 
<sqlMapConfig> 
  <settings
  cacheModelsEnabled="true"
  enhancementEnabled="true"
  maxSessions="64"
  maxTransactions="8"
  maxRequests="128"
  useStatementNamespaces="true"/> 
<!--
 <transactionManager type="EXTERNAL">
  <dataSource type="JNDI">  
   <property name="DataSource" value="jdbc/ejb/SPS"/>
  </dataSource>
 </transactionManager>
-->
 
 <transactionManager type="JDBC" >
  <dataSource type="SIMPLE">
   <property name="JDBC.Driver" value="oracle.jdbc.driver.OracleDriver"/>
   <property name="JDBC.ConnectionURL" value="jdbc:oracle:thin:@10.0.97.62:1521:TERRA"/>
   <property name="JDBC.Username" value="SPS_DEV"/>
   <property name="JDBC.Password" value="SPS_DEV"/>
   <property name="JDBC.DefaultAutoCommit" value="true" />
   <property name="Pool.MaximumActiveConnections" value="10"/>
   <property name="Pool.MaximumIdleConnections" value="5"/>
   <property name="Pool.MaximumCheckoutTime" value="120000"/>
   <property name="Pool.TimeToWait" value="500"/>
   <property name="Pool.PingQuery" value="select * from TDSP_NOTES_SAMPLE"/>
   <property name="Pool.PingEnabled" value="false"/>
   <property name="Pool.PingConnectionsOlderThan" value="1"/>
   <property name="Pool.PingConnectionsNotUsedFor" value="1"/>
  </dataSource>
 </transactionManager>
 
 <sqlMap resource="ie/gov/agriculture/sps/app/dao/xml/EntCustLinkData.xml"/>
 <sqlMap resource="ie/gov/agriculture/sps/app/dao/xml/FarmerDetailsData.xml"/>
 <sqlMap resource="ie/gov/agriculture/sps/app/dao/xml/CodeTable.xml"/> 
 <sqlMap resource="ie/gov/agriculture/sps/app/dao/xml/ScannedDocumentSummaryData.xml"/>
 <sqlMap resource="ie/gov/agriculture/sps/app/dao/xml/NotesData.xml"/>
 <sqlMap resource="ie/gov/agriculture/sps/app/dao/xml/CommonageAllocData.xml"/>
 .....
 ..... 
  
</sqlMapConfig>
 
Project A dao.xml
 
<daoConfig>
 <!-- iBatis DAO configuration file -->
   <context>
     <!-- Static content -->
  <transactionManager type="SQLMAP">
   <property 
    name="SqlMapConfigResource"
    value=" ie/gov/agriculture/sps/app/dao/xml/@SQL_CONFIG_MAP@"/  <mailto:ie/gov/agriculture/sps/app/dao/xml/@SQL_CONFIG_MAP@%22/>
>
  </transactionManager> 
  <dao interface="ie.gov.agriculture.sps.app.dao.PrePrintDetailsDAO" 
   implementation="ie.gov.agriculture.sps.app.dao.impl.PrePrintDetailsSQLMapDAO"/> 
  <dao interface="ie.gov.agriculture.sps.app.dao.ApplicationDAO" 
   implementation="ie.gov.agriculture.sps.app.dao.impl.ApplicationSQLMapDAO"/>  
  <dao interface="ie.gov.agriculture.sps.app.dao.EntCustLinkDAO" 
   implementation="ie.gov.agriculture.sps.app.dao.impl.EntCustLinkSQLMapDAO"/>   
  <dao interface="ie.gov.agriculture.sps.app.dao.StopsDAO" 
   implementation="ie.gov.agriculture.sps.app.dao.impl.StopsSQLMapDAO"/> 
  <dao interface="ie.gov.agriculture.sps.app.dao.FarmerSearchDAO" 
   implementation="ie.gov.agriculture.sps.app.dao.impl.FarmerSearchJDBCDAO"/> 
  <dao interface="ie.gov.agriculture.sps.app.dao.CodeDAO" 
   implementation="ie.gov.agriculture.sps.app.dao.impl.CodeTableDAO"/> 
  <dao interface="ie.gov.agriculture.sps.app.dao.ScannedDocumentSummaryDAO" 
   implementation="ie.gov.agriculture.sps.app.dao.impl.ScannedDocumentSummarySQLMapDAO"/>
  <dao interface="ie.gov.agriculture.sps.app.dao.ScannedDocumentImagesDAO" 
   implementation="ie.gov.agriculture.sps.app.dao.impl.ScannedDocumentImageSQLMAPDAO"/>

  <!--
  <dao interface="ie.gov.agriculture.sps.app.dao.Audit" 
   implementation="ie.gov.agriculture.sps.app.dao.impl.AuditDAO"/>-->    
  <dao interface="ie.gov.agriculture.sps.app.dao.CommonageAllocDAO" 
   implementation="ie.gov.agriculture.sps.app.dao.impl.CommonageAllocSQLMapDAO"/>
      
  ....
  ....
 </context> 
 
   <context>
     <!-- Static content -->
  <transactionManager type="SQLMAP">
   <property 
    name="SqlMapConfigResource"
    value="  <mailto:ie/gov/agriculture/sps/app/dao/xml/@SQL_CONFIG_MAP_IFORIS@%22/>
ie/gov/agriculture/sps/app/dao/xml/@SQL_CONFIG_MAP_IFORIS@"/>
  </transactionManager>
 
  <dao interface="ie.gov.agriculture.sps.app.dao.IForisDAO" 
   implementation="ie.gov.agriculture.sps.app.dao.impl.IForisSQLMapDAO"/> 
 </context> 
 
</daoConfig>
 
 
Project B sql-map-config.xml
 
<sqlMapConfig> 
  <settings
  cacheModelsEnabled="true"
  enhancementEnabled="true"
  maxSessions="64"
  maxTransactions="8"
  maxRequests="128"
  useStatementNamespaces="true"/> 
<!--
 <transactionManager type="EXTERNAL">
  <dataSource type="JNDI">  
   <property name="DataSource" value="jdbc/ejb/SPS"/>
  </dataSource>
 </transactionManager>
-->
 
 <transactionManager type="JDBC" >
  <dataSource type="SIMPLE">
   <property name="JDBC.Driver" value="oracle.jdbc.driver.OracleDriver"/>
   <property name="JDBC.ConnectionURL" value="jdbc:oracle:thin:@10.0.97.62:1521:TERRA"/>
   <property name="JDBC.Username" value="SPS_DEV"/>
   <property name="JDBC.Password" value="SPS_DEV"/>
   <property name="JDBC.DefaultAutoCommit" value="true" />
   <property name="Pool.MaximumActiveConnections" value="10"/>
   <property name="Pool.MaximumIdleConnections" value="5"/>
   <property name="Pool.MaximumCheckoutTime" value="120000"/>
   <property name="Pool.TimeToWait" value="500"/>
   <property name="Pool.PingQuery" value="select * from TDSP_NOTES_SAMPLE"/>
   <property name="Pool.PingEnabled" value="false"/>
   <property name="Pool.PingConnectionsOlderThan" value="1"/>
   <property name="Pool.PingConnectionsNotUsedFor" value="1"/>
  </dataSource>
 </transactionManager>
 
 <sqlMap resource="ie/gov/agriculture/spsinet/app/dao/xml/SavedDraftData.xml"/>


</sqlMapConfig>
 
Project B dao.xml
 
<daoConfig>
 <!-- iBatis DAO configuration file -->
   <context>
     <!-- Static content -->
  <transactionManager type="SQLMAP">
   <property 
    name="SqlMapConfigResource"
    value=" ie/gov/agriculture/spsinet/app/dao/xml/@SQL_CONFIG_MAP@"/  <mailto:ie/gov/agriculture/spsinet/app/dao/xml/@SQL_CONFIG_MAP@%22/>
>
  </transactionManager>
  
  <dao interface="ie.gov.agriculture.spsinet.app.dao.SampleDraftSaveDAO" 
   implementation="ie.gov.agriculture.spsinet.app.dao.impl.SampleDraftSaveSQLMapDAO"/>
 
  <dao interface="ie.gov.agriculture.spsinet.app.dao.SavedDraftJDBCDAO" 
   implementation="ie.gov.agriculture.spsinet.app.dao.impl.SavedDraftJDBCSQLMapDAO"/> 

  <dao interface="ie.gov.agriculture.spsinet.app.dao.AgentSearchDAO" 
   implementation="ie.gov.agriculture.spsinet.app.dao.impl.AgentSearchJDBCDAO"/> 
  
 </context> 
</daoConfig>
 
---------------------------------------------------------------------------------------------------------------
Supporting Code
 
The following code is the code that is failing to commit. The DAOConfig in question below
is 
coming from Project A so is therefore associtaed with dao.xml from that project above.
 
 DaoManager manager = null;
        
        try
        {
            manager = DAOConfig.getDaomanager();
            /* Insert a record on the Application Table */
            dao = (ApplicationDAO) manager.getDao(ApplicationDAO.class);
            
            manager.startTransaction();
            //various inserts
 
            manager.commitTransaction();
 
     }
        catch (Exception e)
        {
            throw new SPSBusinessException(e);
        }
        finally
        {
            if (manager != null)
            {
                
                manager.endTransaction();
            }
        }

 
 
 
-----Original Message-----
From: Brandon Goodin [mailto: brandon.goodin@gmail.com]
Sent: 12 December 2006 15:40
To: user-java@ibatis.apache.org
Subject: Re: Problem committing records using IBATIS in embedded jar file



Please post your dao.xml and sqlmap-config.xml from ProjectA and ProjectB. Also, post any
supporting code that is failing to commit (code that loads the dao.xml, code that loads sqlmapconfig.xml,
code that starts and commits the transaction, etc....). This will help us to see what you
are doing and will likely get you an answer that is not a guess. 

Brandon


On 12/12/06, Ross, Niall < Niall.Ross@agriculture.gov.ie> wrote: 

Hi,

I am having the following problem and I was wondering had anyone encountered this type of
thing before
or could someone possibly lend a hand with a solution.

Ok here's the setup:

Project A uses ibatis to control all transaction management functionality needed. 
Project B also uses ibatis but also includes Project A in the form of a jar.

We are currently developing in Project B and wish to prevent duplication of code so we
want to re-use the DB related calls from Project A within Project B through the Project A
jar. 
With me so far???

When we execute code from Project A that alters a table in some way we use the DAOManager
to
start, end and commit the transactions. This is working in Project A.

The problem occurs when trying to execute this same code through the jar file from within
Project B 
as when we the execute the code the transaction does not get committed at all. It will however
be committed
when I physically shutdown my local appserver.

It seems to me that there is some sort of IBATIS config conflict problem when trying to execute
transaction management 
in the way described above.

Does anyone have any suggestions?

Regards,
Niall



****************************************************************************
***************  Department of Agriculture and Food ****************** 

The information contained in this email and in any attachments is
confidential and is designated solely for the attention and use of
the intended recipient(s). This information may be subject to legal
and professional privilege.  If you are not an intended recipient of 
this email, you must not use, disclose, copy, distribute or retain
this message or any part of it. If you have received this email in
error, please notify the sender immediately and delete all copies
of this email from your computer system(s). 
****************************************************************************


****************************************************************************
****************  An Roinn Talmha+AO0-ochta Agus Bia  ******************* 

T+AOE an t-eolais san r+AO0-omhphost seo, agus in aon ceangl+AOE-in leis,
faoi phribhl+AOk-id agus faoi r+APo-n agus le h-aghaigh an seola+AO0 amh+AOE-in.
D+IBk-fh+AOk-adfadh +AOE-bhar an seoladh seo bheith faoi phribhl+AOk-id 
profisi+APo-nta n+APM dl+AO0-thi+APo-il. Mura tusa an seola+AO0 a bh+AO0 beartaithe
leis an r+AO0-omhphost seo a fh+AOE-il, t+AOE cosc air, n+APM aon chuid de,
a +APo-s+AOE-id, a ch+APM-ipe+AOE-l, n+APM a scaoileadh.  M+AOE th+AOE-inig s+AOk chugat de

bharr dearmad, t+AOk-igh i dteagmh+AOE-il leis an seolt+APM-ir agus scrios an
t-+AOE-bhar +APM do r+AO0-omhaire le do thoil.
****************************************************************************




**************************************************************************** 

*************** Department of Agriculture and Food ******************



 

The information contained in this email and in any attachments is 

confidential and is designated solely for the attention and use of 

the intended recipient(s). This information may be subject to legal 

and professional privilege. If you are not an intended recipient of

this email, you must not use, disclose, copy, distribute or retain 

this message or any part of it. If you have received this email in 

error, please notify the sender immediately and delete all copies

of this email from your computer system(s).

**************************************************************************** 



 



 

**************************************************************************** 

**************** An Roinn Talmhaíochta Agus Bia *******************



 

Tá an t-eolais san ríomhphost seo, agus in aon ceangláin leis, 

faoi phribhléid agus faoi rún agus le h-aghaigh an seolaí amháin.

D'fhéadfadh ábhar an seoladh seo bheith faoi phribhléid 

profisiúnta nó dlíthiúil. Mura tusa an seolaí a bhí beartaithe 

leis an ríomhphost seo a fháil, tá cosc air, nó aon chuid de, 

a úsáid, a chóipeál, nó a scaoileadh. Má tháinig sé chugat de 

bharr dearmad, téigh i dteagmháil leis an seoltóir agus scrios an 

t-ábhar ó do ríomhaire le do thoil. 

****************************************************************************

 



****************************************************************************   
***************  Department of Agriculture and Food ******************

The information contained in this email and in any attachments is 
confidential and is designated solely for the attention and use of 
the intended recipient(s). This information may be subject to legal 
and professional privilege.  If you are not an intended recipient of
this email, you must not use, disclose, copy, distribute or retain 
this message or any part of it. If you have received this email in 
error, please notify the sender immediately and delete all copies
of this email from your computer system(s).
****************************************************************************   


****************************************************************************   
****************  An Roinn Talmhaíochta Agus Bia  *******************

Tá an t-eolais san ríomhphost seo, agus in aon ceangláin leis, 
faoi phribhléid agus faoi rún agus le h-aghaigh an seolaí amháin.
D’fhéadfadh ábhar an seoladh seo bheith faoi phribhléid 
profisiúnta nó dlíthiúil. Mura tusa an seolaí a bhí beartaithe 
leis an ríomhphost seo a fháil, tá cosc air, nó aon chuid de, 
a úsáid, a chóipeál, nó a scaoileadh.  Má tháinig sé chugat de 
bharr dearmad, téigh i dteagmháil leis an seoltóir agus scrios an 
t-ábhar ó do ríomhaire le do thoil.     
****************************************************************************


Mime
View raw message