KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a method, marked as @Transactional. It consists of several functions, one of them uses JDBC and the second one - Hibernate, third - JDBC. The problem is that changes, made by Hibernate function are not visible in the last functions, that works with JDBC. @Transactional void update() { jdbcUpdate1(); hibernateupdate1(); jdbcUpdate2(); // results of hibernateupdate1() are not visible here } All functions are configured to use the same datasource: <bean id="myDataSource" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy"> <property name="targetDataSource" ref="targetDataSource"/> </bean> <bean id="targetDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" lazy-init="true" scope="singleton"> <!-- settings here --> </bean> myDataSource bean is used in the code. myDataSource.getConnection() is used to work with connections in jdbc functions and getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { ... } }); is used in hibernate function. Thanks.
Tags (comma-separated)
Save Edits
Cancel