-
Jan 13th, 2010, 01:07 PM
#1
simplejdbctemplate question
Hello,
If I set up a simple "save" method in my DAO (simplejdbctemplate), do I need to define transactional boundaries explicitly or will spring commit by default (without the need to set up a transaction mgr).
-
Jan 13th, 2010, 09:13 PM
#2
Unexpected behaviour
Ok, this is what I am seeing... If I update the database 3 times, I only see my first two updates reflected in the database. As you would expect, if I updated it 4 times, only 3 updates are reflected in the DB. It seems as though the last update transaction is not being committed. Any ideas why this would be?
-
Jan 14th, 2010, 01:43 AM
#3
if you define a DAO method as transactional, spring will commit or rollback that transaction automatically.
if you do 3 operations and can only see 2 operations in DB, you would have to do a logger displaying what's happening.
without more info I can not say more, sorry.
-
Jan 14th, 2010, 02:53 AM
#4
Basically said, no transactionmanager and no transaction configuration is no transactions is no insert/delete/update to the database. Only if you use a database that doesn't support transactions (like MySQL with MyISAM tables) you might see data in the database.
-
Jan 14th, 2010, 06:27 AM
#5
Looking for documentation...
No transaction manager is required if I am using "plain old" JDBC. If I am using Spring JDBC though, a transaction manager is required? I knew this was required when using ORM tools like hibernate, but for some reason, I thought this was optional for Spring JDBC.
I have been looking through the documentation and have not found some wording that says that a transaction manager is always required. I would like to better understand this. If you know where this is, please let me know.
Thanks for your help.
-
Jan 14th, 2010, 06:34 AM
#6
You need transactions even if you do plain old jdbc, you would start a transaction yourself or use auto commit (which i don't hope you ever did!). You would do ask the connection to start a transaction and in the end commit or rollback.
The DataSourceTransactionManager (TransactionManager is the abstraction for spring).
Again delete/update/insert without Transactions is useless, for spring that means configuring a transactionmanager.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules