Thanks for the reply Costin,
I've been searching through the forum and haven't been able to find anything helpful. I set my spring logs to debug and have the following, I've bolded the important parts:
Code:
17:17:51,536 INFO JdbcTransactionObjectSupport:60 - JDBC 3.0 Savepoint class is available
17:17:51,546 DEBUG HibernateTransactionManager:254 - Using transaction object [org.springframework.orm.hibernate3.HibernateTransactionManager$HibernateTransactionObject@1329642]
17:17:51,546 DEBUG HibernateTransactionManager:281 - Creating new transaction with name [null]
17:17:51,636 DEBUG HibernateTransactionManager:449 - Opened new Session [org.hibernate.impl.SessionImpl@8ceeea] for Hibernate transaction
17:17:51,646 DEBUG HibernateTransactionManager:462 - Preparing JDBC Connection of Hibernate Session [org.hibernate.impl.SessionImpl@8ceeea]
17:17:51,646 DEBUG DriverManagerDataSource:289 - Creating new JDBC Connection to [jdbc:mysql://localhost/mitsu]
17:17:51,716 DEBUG JDBCTransaction:46 - begin
17:17:51,716 DEBUG JDBCTransaction:50 - current autocommit status: true
17:17:51,716 DEBUG JDBCTransaction:52 - disabling autocommit
17:17:51,726 DEBUG HibernateTransactionManager:534 - Exposing Hibernate transaction as JDBC transaction [com.mysql.jdbc.Connection@56860b]
17:17:51,726 DEBUG TransactionSynchronizationManager:162 - Bound value [org.springframework.jdbc.datasource.ConnectionHolder@b122a1] for key [org.springframework.jdbc.datasource.DriverManagerDataSource@7a5a19] to thread [main]
17:17:51,846 DEBUG TransactionSynchronizationManager:162 - Bound value [org.springframework.orm.hibernate3.SessionHolder@1033a6f] for key [org.hibernate.impl.SessionFactoryImpl@f18e8e] to thread [main]
17:17:51,846 DEBUG TransactionSynchronizationManager:214 - Initializing transaction synchronization
@@@ About to insert test model @@@
17:17:51,876 DEBUG CollectionFactory:114 - Creating [java.util.LinkedHashMap]
17:17:51,946 DEBUG CollectionFactory:114 - Creating [java.util.LinkedHashMap]
17:17:51,966 INFO SQLErrorCodesFactory:121 - SQLErrorCodes loaded: [DB2, HSQL, MS-SQL, MySQL, Oracle, Informix, PostgreSQL, Sybase]
17:17:51,966 DEBUG SQLErrorCodesFactory:172 - Looking up default SQLErrorCodes for DataSource [org.springframework.jdbc.datasource.DriverManagerDataSource@7a5a19]
17:17:51,976 DEBUG TransactionSynchronizationManager:137 - Retrieved value [org.springframework.jdbc.datasource.ConnectionHolder@b122a1] for key [org.springframework.jdbc.datasource.DriverManagerDataSource@7a5a19] bound to thread [main]
17:17:51,976 DEBUG TransactionSynchronizationManager:137 - Retrieved value [org.springframework.jdbc.datasource.ConnectionHolder@b122a1] for key [org.springframework.jdbc.datasource.DriverManagerDataSource@7a5a19] bound to thread [main]
17:17:51,976 DEBUG SQLErrorCodesFactory:227 - Database product name cached for DataSource [org.springframework.jdbc.datasource.DriverManagerDataSource@7a5a19]: name is 'MySQL'
17:17:51,976 DEBUG SQLErrorCodesFactory:250 - SQL error codes for 'MySQL' found
17:17:51,976 DEBUG TransactionSynchronizationManager:137 - Retrieved value [org.springframework.orm.hibernate3.SessionHolder@1033a6f] for key [org.hibernate.impl.SessionFactoryImpl@f18e8e] bound to thread [main]
17:17:51,976 DEBUG TransactionSynchronizationManager:137 - Retrieved value [org.springframework.orm.hibernate3.SessionHolder@1033a6f] for key [org.hibernate.impl.SessionFactoryImpl@f18e8e] bound to thread [main]
17:17:51,976 DEBUG HibernateTemplate:358 - Found thread-bound Session for HibernateTemplate
17:17:52,076 DEBUG HibernateTemplate:382 - Not closing pre-bound Hibernate Session after HibernateTemplate
@@@ Test model has been inserted @@@
@@@ Test the model @@@
17:17:52,076 DEBUG HibernateTransactionManager:673 - Triggering beforeCompletion synchronization
17:17:52,076 DEBUG HibernateTransactionManager:581 - Initiating transaction rollback
17:17:52,076 DEBUG HibernateTransactionManager:599 - Rolling back Hibernate transaction on Session [org.hibernate.impl.SessionImpl@8ceeea]
17:17:52,076 DEBUG JDBCTransaction:132 - rollback
17:17:52,127 DEBUG JDBCTransaction:173 - re-enabling autocommit
17:17:52,127 DEBUG JDBCTransaction:143 - rolled back JDBC Connection
17:17:52,137 DEBUG HibernateTransactionManager:697 - Triggering afterCompletion synchronization
17:17:52,137 DEBUG TransactionSynchronizationManager:265 - Clearing transaction synchronization
17:17:52,137 DEBUG TransactionSynchronizationManager:185 - Removed value [org.springframework.orm.hibernate3.SessionHolder@1033a6f] for key [org.hibernate.impl.SessionFactoryImpl@f18e8e] from thread [main]
17:17:52,177 DEBUG TransactionSynchronizationManager:185 - Removed value [org.springframework.jdbc.datasource.ConnectionHolder@b122a1] for key [org.springframework.jdbc.datasource.DriverManagerDataSource@7a5a19] from thread [main]
17:17:52,187 DEBUG HibernateTransactionManager:659 - Closing Hibernate Session [org.hibernate.impl.SessionImpl@8ceeea] after transaction
17:17:52,187 DEBUG SessionFactoryUtils:785 - Closing Hibernate Session
yet, my inserted data doesn't disappear. Here's what my onSetUpInTransaction looks like:
Code:
protected void onSetUpInTransaction() throws Exception {
System.out.println("@@@ About to insert test model @@@");
insertedModel = new ModelContent();
insertedModel.setModelName("TestModel");
insertedModel.setModelType("Hatchback");
insertedModel.setModelYear("2007");
insertedModel.setModelDestPrice(43500.00f);
insertedModel.setModelDestPriceAK(44600.00f);
hibernateTemplate.saveOrUpdate(insertedModel);
System.out.println("@@@ Test model has been inserted @@@");
}
and finally here's my context file:
Code:
<beans>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost/mitsu"/>
<property name="username" value="root"/>
<property name="password" value="***"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<list>
<value>com/organic/mitsu/hib/ModelContent.hbm.xml</value>
<value>com/organic/mitsu/hib/Trim.hbm.xml</value>
<value>com/organic/mitsu/hib/Accessory.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="modelDao" class="com.organic.mitsu.dao.ModelDaoImpl">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="modelServiceTarget" class="com.organic.mitsu.service.ModelServiceImpl" abstract="false">
<property name="modelDao" ref="modelDao"/>
</bean>
<bean id="modelManager" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager"><ref local="transactionManager"/></property>
<property name="target"><ref local="modelServiceTarget"/></property>
<property name="transactionAttributes">
<props>
<prop key="list*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="updateModel">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
</beans>
I'm out of ideas on this, if anything looks suspicious I'd love to see it. Thanks again