• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

@Transactional and rollback not working, spring testing

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm doing an integration test in the spring and I have a problem where during the addition test in the service, rollback not working, but always add an item to the base.
I have annotation @ Transactional and @ TestPropertySource on test class,
I have application-test.properties and the test is successful but the rollback is not executed and a new item is always added to the test database.


My test class and add test method (last one):



My application-test.properties :



And when execute add address test, every time in my kts_test data base ( db used for testing) is added new item and not rollback.

If anyone can help I would be grateful. Thank you.
 
Bartender
Posts: 1249
39
IBM DB2 Netbeans IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Googling a bit, I found this issue about Spring and MySql dialect.
Try to verify if it may work for you.
 
Nemanja Milosavljević
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes that was a problem from the link,
I just managed to solve this morning and couldn't answer.
The problem was with the mySql engine.
By default, it was a myISAM that does not support transactions and had to be changed to the InnoDb engine.
Thanks anyway .
 
These are the worst of times and these are the best of times. And this is the best tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!