The Spring Framework's transaction management support significantly changes traditional thinking as to when a J2EE application requires an application server.
In particular, you don't need an application server just to have declarative transactions via EJB. In fact, even if you have an application server with powerful JTA capabilities, you may well decide that the Spring Framework's declarative transactions offer more power and a much more productive programming model than EJB CMT.
Typically you need an application server's JTA capability only if you need to enlist multiple transactional resources, and for many applications being able to handle transactions across multiple resources isn't a requirement.
in that example, we can use Annotation @Transactional..
i have modified my application's configuration..
and shown like the following code :
is it configuration true?..
iam using sessionFactory and transaction manager..
and the DAO code is like this :
is it DAO have been configured as Transactional mode?..
iam sorry before.. iam still confusing about the rollBackFor Property..
i've been configure Transactional Annotation like this one :
is it the rollback will executed if any errors occured?..
i just use rollbackFor=Exception.class, and not use specify another Exception classes, beacuse all of the Exception classes is inheritated of "java.lang.Exception"..
Thank's in advance
Joined: Aug 15, 2004
You need not define DataSourceTransactionManager, if you are using Hibernate, or you can think the other way around.
Well, if you define general Exception class, then it means you want to rollback the particular transaction in case any exception occurs. There are cases when you still want to commit the transaction if one kind of exceptions occur and rollback the transaction when the other kind of exceptions occur. I hope it made it clear now.
I am configuring hibernate in my spring project i hope you are able to configure.I have a question that you are using persistence.xml or not or there is any kind of entry in your web.xml file for your persistence.xml file.can you provide me your sample files which you use in your project just a basic one.
subject: How to configure Transaction in Spring and Hibernate Annotation?..