Forums Register Login

Ubuntu jpa hibernate problem

+Pie Number of slices to send: Send
I've got a problem (so what else is new!) and I'm not sure what's causing it.

I'm using Ubuntu 8.10 (same problem with 8.04), JPA with Hibernate as the provider and Spring 2.5.5. This problem does not exist when running the same code in windows.

I've a junit 4 test ...



The problem is, in Ubuntu, the article is not rolled back ... it should be.

In Windows, after the test is run, the article is rolled back.

Any ideas why I'm getting this behavior in Ubuntu?
+Pie Number of slices to send: Send
Based on the @Autowire annotation, i guess you are using Spring. I don't have any experience in Spring. Looking at your code, i don't see any specific reason why the transaction should be rolled back. Can you please provide more details about you test case and why you are expecting the transaction to rollback?
+Pie Number of slices to send: Send
It's a JPA thing ... unless entityManager.persist(article) is called, the transaction should not be committed. Under Windows it works correctly, under Ubuntu, the transaction is committed when it should not be.
+Pie Number of slices to send: Send
Eventually found the answer to the problem. It seems that on Windows I had MySQL set to use INNODB and on Ubuntu it was using MyISAM. MyISAM isn't transactional, therefore my rows weren't being rolled back.

Sorry to have blamed Ubuntu. (Now to get this Windows virus off my machine and reinstall Ubuntu)
Try 100 things. 2 will work out, but you will never know in advance which 2. This tiny ad might be one:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1015 times.
Similar Threads
JPA UserTransaction not rolled back
Data Access Objects: static methods
Problems understanding EJB transactions and isolation
JPA transaction rollback fails with call to stateless bean
JUnit 4 and @RunAs annotation
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 06:21:35.