Hi, I am upgrading from hibernate 3.1 to hibernate 5.2 and I am running into an issue where I am getting this exception when I call the following method below. It worked fine in hibernate 3.1 but I don’t understand why it says transaction required.
Reading a lot online says to add @Transactional to the method or class and try changing the propegation but it doesn’t seem to work and it will make the Dao object I get from the bean null (the proxy is populated but it doesn’t wrap the object). I contacted spring and they said it is an issue with hibernate so I am looking for some help on this issue. Thanks.
// this is a sample DAO I have (simplified) that is saying transaction required
public class TestDao extends HibernateTemplate {
protected Integer batchSize;
public void updateNames() {
String deleteHQL = "delete from users";
this.getHibernateTemplate().bulkUpdate(deleteHQL);
}
}
Application Context:
<bean id="testDao" name="dao" class="com.test.TestDao">
<property name="batchSize" value="2000" />
</bean>
When I call TextDao testDao = (TestDao) myContext.getBean("testDao");
with @Transactional, I see this: