Hi ,
My app uses Struts(1.4) + Spring(1.1.1) + Hibernate(2.1)
I have noticed that whenever any insert or update is done ,
the data does not get commited ,
following is the configuration details
1. I use contextLoaderPlugin to integrate Struts and Spring
<plug-in className="org.springframework.web.struts.ContextL oaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/applicationContext.xml,/WEB-INF/action-servlet.xml"/>
</plug-in>
2. I have following configuration for hibernate and Spring
<bean id="mySessionFactory" class="org.springframework.orm.hibernate.LocalSess ionFactoryBean">
<property name="mappingResources">
<list>
<!--<value>org/med/common/User.hbm.xml</value> -->
<value>org/med/common/Responsibilities.hbm.xml</value>
<value>org/med/common/core/model/Product.hbm.xml</value>
<value>org/med/common/core/model/Order.hbm.xml</value>
<value>org/med/common/core/model/OrderItem.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">net.sf.hibernate.dialect.O racleDialect</prop>
<prop key="hibernate.connection.driver_class">oracle.jdb c.driver.OracleDriver</prop>
<prop key="hibernate.connection.username">user</prop>
<prop key="hibernate.connection.password">password</prop>
<prop key="hibernate.connection.url">jdbc:oracle:thin:@l ocalhost:1521:sid</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
<bean id="myTransactionManager" class="org.springframework.orm.hibernate.Hibernate TransactionManager">
<property name="sessionFactory"><ref local="mySessionFactory"/></property>
</bean>
<!-- ***** ORDER SERVICE *****-->
<bean id="orderService" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
<property name="transactionManager"><ref local="myTransactionManager"/></property>
<property name="target"><ref local="orderDAO"/></property>
<property name="transactionAttributes">
<props>
<prop key="find*">PROPAGATION_REQUIRED,readOnly,-OrderException</prop>
<prop key="save*">PROPAGATION_REQUIRED,-OrderException,-OrderMinimumAmountException</prop>
<prop key="create*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!-- Order DAO object: Hibernate implementation -->
<bean id="orderDAO" class="org.med.common.core.dao.OrderDAO" singleton="false">
<property name="sessionFactory"><ref local="mySessionFactory"/></property>
</bean>
3. In my hibernate DAO I do followng thing
public void createOrder(Order order){
getHibernateTemplate().saveOrUpdate(order);
}
When I run my application , I see following sql's being generate
Hibernate: insert into beta_orders (order_date, price_total, id) values (?, ?, ?)
Hibernate: insert into beta_order_items (amount, price, order_id, product_id, id) values (?, ?, ?, ?, ?)
Hibernate: update beta_products set name=?, price=?, amount=? where id=?
The problem is the data gets reflected in my DB once I shutdown the server,
I guess Iam missing out some basic parameter in my configuration files like auto commit.
Thanks
-Hari


Reply With Quote