Announcement Announcement Module
Collapse
No announcement yet.
Transactions, iBatis, Sybase, and not seeing commits Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Transactions, iBatis, Sybase, and not seeing commits

    I'm using iBatis for my Dao layer and having Spring manage it. My database is Sybase ASE 12. I've configured Spring to utilize JTA. The problem I'm having is that I see from the logs that the transacitons are starting and commiting, but I'm not always seeing the writes to the database. One example is I'm trying to insert an Order. The transaction starts, I get the next sequence, which is a select against the database and an update and I see this participating in the existing transaction, I then insert the Order then I insert the Line Item, which participates in the transaction. I see from the logging all the transaction work being performed. I then see the commits. The problem is that the sequence table is being updated and I see the value in the database updated, but there are no entries in the Order table or the Line Item table. No SQL exceptions are thrown

    DataAccessContext.xml
    Code:
    	<jndi:lookup id="ciimDataSource" jndiName="java:comp/env/jdbc/ciim"/>
    	<jndi:lookup id="csisDataSource" jndiName="java:comp/env/jdbc/csis"/>
    	<bean id="userTransaction" class="org.springframework.jndi.JndiObjectFactoryBean">
    		<property name="jndiName" value="java:comp/env/UserTransaction" />
    	</bean>
    	<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
    		<property name="userTransactionName"  value="java:comp/env/UserTransaction"/>
    	</bean>
    <bean id="matchAllTxInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
          <property name="transactionManager">
    		  <ref bean="transactionManager"/>
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="insert*">PROPAGATION_REQUIRED</prop>
    				<prop key="update*">PROPAGATION_REQUIRED</prop>
    				<prop key="delete*">PROPAGATION_REQUIRED</prop>
    				<prop key="getNext*">PROPAGATION_REQUIRED</prop>
    				<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
    			</props>
    		</property>		
        </bean>
        
    <bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
          <property name="interceptorNames">
            <list>
              <idref local="matchAllTxInterceptor"/>
            </list>
          </property>
          <property name="beanNames">
            <list>
              <value>*Dao</value>
            </list>
          </property>
        </bean>
    	<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
    		<property name="configLocation" value="WEB-INF/ciim-sql-map-config.xml"/>
    	</bean>
    	<bean id="currencyDao" class="com.sybase.cosmos.dao.impl.CurrencyDaoImpl">
    		<property name="dataSource" ref="ciimDataSource"/>
    		<property name="sqlMapClient" ref="sqlMapClient"/>
    	</bean>
    Logging output
    Code:
    Creating new transaction with name [com.sybase.cosmos.dao.OrderDao.insert]
    begin transaction
    threadTx.get= java.lang.ThreadLocal@b49b19
    xid= bb14:38:0:0106492d747e3e37a9...58700b:
    timeout= 360
    TransactionImpl.doAttach flag= TMJOIN
    number of enlisted= 0
    threadTx.set= java.lang.ThreadLocal@b49b19
    Associate tx to xid (xid=bb14:38:0:0106492d747e3e37a9...58700b:)
    TimerEvent.new(bb14:38:0:0106492d747e3e37a9...58700b:,360,null,false)
    set timer for tx (timer=org.objectweb.jotm.TimerEvent@1e6cf07, tx=bb14:38:0:0106492d747e3e37a9...58700b:)
    set date for tx (data=Thu Feb 16 17:05:00 PST 2006, tx=bb14:38:0:0106492d747e3e37a9...58700b:)
    Initializing transaction synchronization
    Getting transaction for com.sybase.cosmos.dao.SequenceDao.getNextOrderNumber
    Using transaction object [org.springframework.transaction.jta.JtaTransactionObject@b53b32]
    Current.getStatus()
    threadTx.get= java.lang.ThreadLocal@b49b19
    TransactionImpl.getStatus()
    Participating in existing transaction
    Statement: Sequence-getSequence
    Fetching JDBC Connection from DataSource
    Registering transaction synchronization for JDBC Connection
    Bound value [org.springframework.jdbc.datasource.ConnectionHolder@19ae493] for key [org.apache.tomcat.dbcp.dbcp.BasicDataSource@617584] to thread [http-8080-Processor24]
    {conn-100122} Connection
    {pstm-100123} PreparedStatement:      SELECT *     FROM default_numbers     WHERE type = ?   
    Retrieved value [org.springframework.jdbc.datasource.ConnectionHolder@19ae493] for key [org.apache.tomcat.dbcp.dbcp.BasicDataSource@617584] bound to thread [http-8080-Processor24]
    Retrieved value [org.springframework.jdbc.datasource.ConnectionHolder@19ae493] for key [org.apache.tomcat.dbcp.dbcp.BasicDataSource@617584] bound to thread [http-8080-Processor24]
    {conn-100125} Connection
    {pstm-100126} PreparedStatement:      UPDATE default_numbers     SET default_no = ?     WHERE type = ?   
    Retrieved value [org.springframework.jdbc.datasource.ConnectionHolder@19ae493] for key [org.apache.tomcat.dbcp.dbcp.BasicDataSource@617584] bound to thread [http-8080-Processor24]
    Invoking commit for transaction on com.sybase.cosmos.dao.SequenceDao.getNextOrderNumber
    Parameter: com.sybase.cosmos.domain.Order@fb1135
    Statement: Order-insert
    Retrieved value [org.springframework.jdbc.datasource.ConnectionHolder@19ae493] for key [org.apache.tomcat.dbcp.dbcp.BasicDataSource@617584] bound to thread [http-8080-Processor24]
    {conn-100127} Connection
    {pstm-100128} PreparedStatement:         insert into oeorder_header (order_code, order_no, home_company_code,        status_code, customer_no, bill_to_location, ship_to_location,        abbreviation, customer_po_no, ship_all_to_one, ship_via_code,        date_entered, due_date, revised_due_date, customer_due_date,        last_activity_date, allow_backorders, tax_exempt_no, tax_exempt_flag,        ship_to_tax, fob_code, fob_destination, discount_type, discount_percent,        salesrep_code1, salesrep_code2, authorize_id, auto_close, tolerance,        buyer, buyer_phone, engineer, engineer_phone, dest_location,        order_currency_code, terms_code, record_date, balance, price_list_type,        apl_ref_date, auto_invoice_yn, ship_charge_yn, special_tax_code,        invoice_language_code, drop_ship_yn, ops_center_code, method_of_payment,        clarify_casenum, clarify_casenum_objid, reference_order_no, priority,        doc_language, doc_config_type, license_cbss, credit_check)      values (?, ?, ?,        ?, ?, ?,        ?, ?,        ?, ?, ?,        ?, ?, ?,        ?, ?,        ?, ?, ?,        ?, ?, ?,        ?, ?,        ?, ?, ?,        ?, ?, ?,        ?, ?, ?,        ?, ?,        ?, ?, ?,        ?, ?, ?,        ?, ?, ?,        ?, ?, ?,        ?, ?,        ?, ?, ?,        ?, ?, ?)     
    Retrieved value [org.springframework.jdbc.datasource.ConnectionHolder@19ae493] for key [org.apache.tomcat.dbcp.dbcp.BasicDataSource@617584] bound to thread [http-8080-Processor24]
    Getting transaction for com.sybase.cosmos.dao.LineItemDao.insert
    Using transaction object [org.springframework.transaction.jta.JtaTransactionObject@1cc5312]
    Current.getStatus()
    threadTx.get= java.lang.ThreadLocal@b49b19
    Transaction ret= bb14:38:0:0106492d747e3e37a9...58700b:
    TransactionImpl.getStatus()
    Participating in existing transaction
    Retrieved value [org.springframework.jdbc.datasource.ConnectionHolder@19ae493] for key [org.apache.tomcat.dbcp.dbcp.BasicDataSource@617584] bound to thread [http-8080-Processor24]
    {pstm-100130} PreparedStatement:      insert into oeorder_detail (order_code, order_no, line_no, status_code,        item_type, catalog_no, catalog_desc, ship_to_abbr, taxyn, priority,        buy_qty_due, unit_price, price_break, list_price, customer_due_date,        revised_due_date, date_entered, last_activity_date, discount_type,        discount_percent, salesrep_comm1, salesrep_comm2, salesrep_code1,        salesrep_code2, part_no, contract, ship_via_code, unit_meas, fob_code,        fob_destination, terms_code, dest_location, apt_sched_flag, apt_date,        cust_config_no, base_flag, qty_per_assembly, leadtime_offset,        supply_order_type, supply_order_code, supply_order_no, supply_release,        supply_sequence_no, currency_code, record_date, balance, order_descr,        orig_list_price, parent_line_no, release_flag, media_qty_due, serial_no,        serial_type)      values (?, ?, ?,        ?, ?, ?,        ?, ?, ?,        ?, ?, ?,        ?, ?, ?,        ?, ?,        ?, ?,        ?, ?, ?,        ?, ?, ?,        ?, ?, ?,        ?, ?, ?,        ?, ?, ?,        ?, ?, ?,        ?, ?,        ?, ?,        ?, ?,        ?, ?, ?,        ?, ?, ?,        ?, ?, ?,        ?)    
    Retrieved value [org.springframework.jdbc.datasource.ConnectionHolder@19ae493] for key [org.apache.tomcat.dbcp.dbcp.BasicDataSource@617584] bound to thread [http-8080-Processor24]
    Invoking commit for transaction on com.sybase.cosmos.dao.LineItemDao.insert
    Invoking commit for transaction on com.sybase.cosmos.dao.OrderDao.insert
    Triggering beforeCommit synchronization
    Triggering beforeCompletion synchronization
    Removed value [org.springframework.jdbc.datasource.ConnectionHolder@19ae493] for key [org.apache.tomcat.dbcp.dbcp.BasicDataSource@617584] from thread [http-8080-Processor24]
    Returning JDBC Connection to DataSource
    Initiating transaction commit
    Current.getStatus()
    threadTx.get= java.lang.ThreadLocal@b49b19
    Transaction ret= bb14:38:0:0106492d747e3e37a9...58700b:
    TransactionImpl.getStatus()
    commit transaction 
    threadTx.get= java.lang.ThreadLocal@b49b19
    TransactionImpl.commit (tx= bb14:38:0:0106492d747e3e37a9...58700b:)
    unset timer for tx (timer=org.objectweb.jotm.TimerEvent@1e6cf07, tx=bb14:38:0:0106492d747e3e37a9...58700b:)
    TimerEvent(bb14:38:0:0106492d747e3e37a9...58700b:).unset
    threadTx.set = null
    remove tx from xid (xid=bb14:38:0:0106492d747e3e37a9...58700b:)
    threadTx.set= null
    reset timeout= 360
    Triggering afterCompletion synchronization
    Clearing transaction synchronization

    Thanks for the help....
Working...
X