Hi All
I am using spring's declartive transaction mechanism
I am trying to insert 2 rows .One row is fine
But other row has null field in not null column
When I am trying to insert it ,first row gets inserted
But other row does not because of bad data
However whole trnsaction shd be rollback
Here is the code snippet
==========================================
public class TradeDAOImpl extends HibernateDaoSupport
{
public void saveTrade(IProduct iProduct) {
Session session = null;
IProduct temp=new Swap();
temp.setIsSwapswire(new Boolean(false));
temp.setManualTicketYN(new Boolean(false));
temp.setProductId(null);
temp.setTradeFeedTypeId(iProduct.getTradeFeedTypeI d());
temp.setTradeId(iProduct.getTradeId());
temp.setTraderGroupId(iProduct.getTraderGroupId()) ;
session=getSession();
try{
session.save(iProduct);//THIS DATA IS FINE
session.save(temp);//WRONG DATA
}catch(HibernateException ex)
{
ex.printStackTrace();
throw convertHibernateAccessException(ex);
}
finally{
session.close();
}
}
========
Here is my config file details
<bean id="myTxManager" class="org.springframework.transaction.jta.WebLogi cJtaTransactionManager"/>
<bean id="myTransactionFactory" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
<property name="transactionManager" ref="myTxManager"/>
<property name="target" ref="hibernate.tradeDAO"/>
<property name="transactionAttributes">
<props>
<prop key="saveTrade*">PROPAGATION_REQUIRED,-HibernateException</prop>
<prop key="update*">PROPAGATION_REQUIRED,-HibernateException</prop>
<prop key="*">PROPAGATION_REQUIRED,readOnly,-HibernateException</prop>
</props>
</property>
</bean>
<bean id="myDataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiName" value="EblotterDS"/>
</bean>
Plz help me as I am stuck in this
Thnx
Kunal