Java Doc for SqlMapTransactionManager.java in  » Database-ORM » iBATIS » com » ibatis » sqlmap » client » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » iBATIS » com.ibatis.sqlmap.client 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.ibatis.sqlmap.client.SqlMapTransactionManager

SqlMapTransactionManager
public interface SqlMapTransactionManager (Code)
This interface declares methods for demarcating SQL Map transactions.
See Also:   SqlMapSession
See Also:   
See Also:   SqlMapClient




Method Summary
public  voidcommitTransaction()
     Commits the currently started transaction.
public  voidendTransaction()
     Ends a transaction and rolls back if necessary.
public  ConnectiongetCurrentConnection()
     Returns the current connection in use.
public  DataSourcegetDataSource()
     Returns the DataSource instance currently being used by the SqlMapSession.
public  ConnectiongetUserConnection()
     Returns the current user supplied connection as set by setUserConnection().
public  voidsetUserConnection(Connection connnection)
     Allows the developer to easily use an externally supplied connection when executing statements.

Important: Using a user supplied connection basically sidesteps the transaction manager, so you are responsible for appropriately.

public  voidstartTransaction()
     Demarcates the beginning of a transaction scope.
public  voidstartTransaction(int transactionIsolation)
     Demarcates the beginning of a transaction scope using the specified transaction isolation.



Method Detail
commitTransaction
public void commitTransaction() throws SQLException(Code)
Commits the currently started transaction.
throws:
  SQLException - If an error occurs while committing the transaction, orthe transaction could not be committed.



endTransaction
public void endTransaction() throws SQLException(Code)
Ends a transaction and rolls back if necessary. If the transaction has been started, but not committed, it will be rolled back upon calling endTransaction().
throws:
  SQLException - If an error occurs during rollback or the transaction couldnot be ended.



getCurrentConnection
public Connection getCurrentConnection() throws SQLException(Code)
Returns the current connection in use. If no connection exists null will be returned. There may be no connection if no transaction has been started, and if no user provided connection has been set. The current connection or null.
throws:
  SQLException -



getDataSource
public DataSource getDataSource()(Code)
Returns the DataSource instance currently being used by the SqlMapSession. The DataSource instance currently being used by the SqlMapSession.



getUserConnection
public Connection getUserConnection() throws SQLException(Code)
Returns the current user supplied connection as set by setUserConnection().

TODO : DEPRECATED The current user supplied connection.
throws:
  SQLException -




setUserConnection
public void setUserConnection(Connection connnection) throws SQLException(Code)
Allows the developer to easily use an externally supplied connection when executing statements.

Important: Using a user supplied connection basically sidesteps the transaction manager, so you are responsible for appropriately. Here's a (very) simple example (throws SQLException):

 try {
 Connection connection = dataSource.getConnection();
 sqlMap.setUserConnection(connection);
 // do work
 connection.commit();
 } catch (SQLException e) {
 try {
 if (connection != null) commit.rollback();
 } catch (SQLException ignored) {
 // generally ignored
 }
 throw e;  // rethrow the exception
 } finally {
 try {
 if (connection != null) connection.close();
 } catch (SQLException ignored) {
 // generally ignored
 }
 }
 

Parameters:
  connnection -
throws:
  SQLException -



startTransaction
public void startTransaction() throws SQLException(Code)
Demarcates the beginning of a transaction scope. Transactions must be properly committed or rolled back to be effective. Use the following pattern when working with transactions:
 try {
 sqlMap.startTransaction();
 // do work
 sqlMap.commitTransaction();
 } finally {
 sqlMap.endTransaction();
 }
 

Always call endTransaction() once startTransaction() has been called.
throws:
  java.sql.SQLException - If an error occurs while starting the transaction, orthe transaction could not be started.




startTransaction
public void startTransaction(int transactionIsolation) throws SQLException(Code)
Demarcates the beginning of a transaction scope using the specified transaction isolation. Transactions must be properly committed or rolled back to be effective. Use the following pattern when working with transactions:
 try {
 sqlMap.startTransaction(Connection.TRANSACTION_REPEATABLE_READ);
 // do work
 sqlMap.commitTransaction();
 } finally {
 sqlMap.endTransaction();
 }
 

Always call endTransaction() once startTransaction() has been called.
throws:
  java.sql.SQLException - If an error occurs while starting the transaction, orthe transaction could not be started.




www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.