This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

It shouldn't matter what kind of presentation layer you have, in multi-layer architecture, presenetation layer has dependency on business layer, not the other way around.
Declarative tx managements should be applied on the business layer interface. So you should be able to change you presentation layer without affecting you business layer.
For more detail discussion, please read Rod Johnson's books.

Comment

Perhaps I should clarify myself: I have done declarative tx management in web application via applicationContext.xml and applicationContext-jdbc.xml, but I don't know how to do this in command line application. And all examples I saw on spring site or in book J2ee without EJB are only for web apps.

Comment

Is your question how to load a Spring application context from a console application? If so, take a look in Spring 1.1 Reference Guide section 3.2.1, which shows some of the options. As mentioned by leecoop, it makes no difference how your application contexts get loaded - Spring delivers transaction management just the same.

Comment

Yes, I was trying to do something in this direction. Nevertheless I was out of luck: definitely I managed to get my method in transaction, but there was no effect. Despite rollback (see log bellow) there was insert in database, where there should not be. Perhaps it is not enough to work with connection after dataSorce.getConnection() (I must admit I'm not using any Spring JDBC library)!?
ThankYou for clarification!

log:

sqle in save: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0407N Assignment of a NULL value to a NOT NULL column "TBSPACEID=2, TABLEID=172, COLNO=3" is not allowed. SQLSTATE=23502

Applying rules to determine whether transaction should rollback on java.lang.RuntimeException: [IBM][CLI Driver][DB2/NT] SQL0407N Assignment of a NULL value to a NOT NULL column "TBSPACEID=2, TABLEID=172, COLNO=3" is not allowed. SQLSTATE=23502

Comment

I'm creating a sample application using Spring configuration feature for Transaction management as well as for Database interaction. I'm using Hibernate for that purpose. I'm facing following error while getting the FileSystemXmlApplicationContext object. I've defined applicationContext-hibernate.xml file and passing that to FileSystemXmlApplicationContext class's constructor. When i run the application i get the following error:

Comment

I'm sorry to report I was right: declarative tx management does not work for arbitrary JDBC strategy, one must be compliant with Spring's JDBC handling, that is using its API (org.springframework.jdbc.core, org.springframework.jdbc., etc). How do I know that? Well, I took petclinic sample with spring package (version 1.1-rc2) and added method to HsqlJdbcClinic and to Clinic interface: