Hi guys, I'm currently on learning about Spring integration with Hibernate, and so far I'm getting it to work. But I've run into situation where I dont want to commit the transaction at the end of process because I just want to see the generated sql stattement for testing and debugging purposes.
I have already added <prop key="hibernate.connection.autocommit">false</prop> to my hibernate properties, but then It still doesn't working.
Is it possible to achieve if using Spring to handle hibernate transaction? because in using traditional transaction in hibernate , it is possible, just don't call the session.commit() method and all the updates and insert will not be saved;
currently I have this code for service layer :
code for Dao layer :
But what happens here is that it does commit the transaction!, But I dont want to commit the transaction just for testing and debugging purposes.
I've also tried
@Transactional(propagation = Propagation.SUPPORTS, readOnly = false)
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
But what happens here is that it does not commit the transaction, however the count of employee does not also incrementing.
So, what I am expecting to happen here is that count the number of employee before inserting to employee table. Then insert to employee table and count again the number of employee, so it would increment by 1. But at the end of the process , I don't want to commit that insert!
Do you have any Idea guys?
I would be very thankful for any help!