Java Doc for ConnectionHolder.java in  » J2EE » spring-framework-2.0.6 » org » springframework » jdbc » datasource » 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 » J2EE » spring framework 2.0.6 » org.springframework.jdbc.datasource 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.transaction.support.ResourceHolderSupport
      org.springframework.jdbc.datasource.ConnectionHolder

ConnectionHolder
public class ConnectionHolder extends ResourceHolderSupport (Code)
Connection holder, wrapping a JDBC Connection. DataSourceTransactionManager binds instances of this class to the thread, for a specific DataSource.

Inherits rollback-only support for nested JDBC transactions and reference count functionality from the base class.

Note: This is an SPI class, not intended to be used by applications.
author:
   Juergen Hoeller
since:
   06.05.2003
See Also:   DataSourceTransactionManager
See Also:   DataSourceUtils



Field Summary
final public static  StringSAVEPOINT_NAME_PREFIX
    

Constructor Summary
public  ConnectionHolder(ConnectionHandle connectionHandle)
     Create a new ConnectionHolder for the given ConnectionHandle.
public  ConnectionHolder(Connection connection)
     Create a new ConnectionHolder for the given JDBC Connection, wrapping it with a SimpleConnectionHandle , assuming that there is no ongoing transaction.
public  ConnectionHolder(Connection connection, boolean transactionActive)
     Create a new ConnectionHolder for the given JDBC Connection, wrapping it with a SimpleConnectionHandle .

Method Summary
public  voidclear()
    
public  ObjectcreateSavepoint()
     Create a new JDBC 3.0 Savepoint for the current Connection, using generated savepoint names that are unique for the Connection.
public  ConnectiongetConnection()
     Return the current Connection held by this ConnectionHolder.
public  ConnectionHandlegetConnectionHandle()
     Return the ConnectionHandle held by this ConnectionHolder.
protected  booleanhasConnection()
     Return whether this holder currently has a Connection.
protected  booleanisTransactionActive()
     Return whether this holder represents an active, JDBC-managed transaction.
public  voidreleased()
     Releases the current Connection held by this ConnectionHolder.

This is necessary for ConnectionHandles that expect "Connection borrowing", where each returned Connection is only temporarily leased and needs to be returned once the data operation is done, to make the Connection available for other operations within the same transaction.

protected  voidsetConnection(Connection connection)
     Override the existing Connection handle with the given Connection.
protected  voidsetTransactionActive(boolean transactionActive)
     Set whether this holder represents an active, JDBC-managed transaction.
public  booleansupportsSavepoints()
     Return whether JDBC 3.0 Savepoints are supported.

Field Detail
SAVEPOINT_NAME_PREFIX
final public static String SAVEPOINT_NAME_PREFIX(Code)




Constructor Detail
ConnectionHolder
public ConnectionHolder(ConnectionHandle connectionHandle)(Code)
Create a new ConnectionHolder for the given ConnectionHandle.
Parameters:
  connectionHandle - the ConnectionHandle to hold



ConnectionHolder
public ConnectionHolder(Connection connection)(Code)
Create a new ConnectionHolder for the given JDBC Connection, wrapping it with a SimpleConnectionHandle , assuming that there is no ongoing transaction.
Parameters:
  connection - the JDBC Connection to hold
See Also:   SimpleConnectionHandle
See Also:   ConnectionHolder.ConnectionHolder(java.sql.Connection,boolean)



ConnectionHolder
public ConnectionHolder(Connection connection, boolean transactionActive)(Code)
Create a new ConnectionHolder for the given JDBC Connection, wrapping it with a SimpleConnectionHandle .
Parameters:
  connection - the JDBC Connection to hold
Parameters:
  transactionActive - whether the given Connection is involvedin an ongoing transaction
See Also:   SimpleConnectionHandle




Method Detail
clear
public void clear()(Code)



createSavepoint
public Object createSavepoint() throws SQLException(Code)
Create a new JDBC 3.0 Savepoint for the current Connection, using generated savepoint names that are unique for the Connection. the new Savepoint (typed as Object for JDK 1.3 compatibility)
throws:
  SQLException - if thrown by the JDBC driver



getConnection
public Connection getConnection()(Code)
Return the current Connection held by this ConnectionHolder.

This will be the same Connection until released gets called on the ConnectionHolder, which will reset the held Connection, fetching a new Connection on demand.
See Also:   ConnectionHandle.getConnection
See Also:   ConnectionHolder.released()




getConnectionHandle
public ConnectionHandle getConnectionHandle()(Code)
Return the ConnectionHandle held by this ConnectionHolder.



hasConnection
protected boolean hasConnection()(Code)
Return whether this holder currently has a Connection.



isTransactionActive
protected boolean isTransactionActive()(Code)
Return whether this holder represents an active, JDBC-managed transaction.



released
public void released()(Code)
Releases the current Connection held by this ConnectionHolder.

This is necessary for ConnectionHandles that expect "Connection borrowing", where each returned Connection is only temporarily leased and needs to be returned once the data operation is done, to make the Connection available for other operations within the same transaction. This is the case with JDO 2.0 DataStoreConnections, for example.
See Also:   org.springframework.orm.jdo.DefaultJdoDialect.getJdbcConnection




setConnection
protected void setConnection(Connection connection)(Code)
Override the existing Connection handle with the given Connection. Reset the handle if given null.

Used for releasing the Connection on suspend (with a null argument) and setting a fresh Connection on resume.




setTransactionActive
protected void setTransactionActive(boolean transactionActive)(Code)
Set whether this holder represents an active, JDBC-managed transaction.
See Also:   DataSourceTransactionManager



supportsSavepoints
public boolean supportsSavepoints() throws SQLException(Code)
Return whether JDBC 3.0 Savepoints are supported. Caches the flag for the lifetime of this ConnectionHolder.
throws:
  SQLException - if thrown by the JDBC driver



Methods inherited from org.springframework.transaction.support.ResourceHolderSupport
public void clear()(Code)(Java Doc)
public Date getDeadline()(Code)(Java Doc)
public long getTimeToLiveInMillis() throws TransactionTimedOutException(Code)(Java Doc)
public int getTimeToLiveInSeconds()(Code)(Java Doc)
public boolean hasTimeout()(Code)(Java Doc)
public boolean isOpen()(Code)(Java Doc)
public boolean isRollbackOnly()(Code)(Java Doc)
public boolean isSynchronizedWithTransaction()(Code)(Java Doc)
public void released()(Code)(Java Doc)
public void requested()(Code)(Java Doc)
public void reset()(Code)(Java Doc)
public void setRollbackOnly()(Code)(Java Doc)
public void setSynchronizedWithTransaction(boolean synchronizedWithTransaction)(Code)(Java Doc)
public void setTimeoutInMillis(long millis)(Code)(Java Doc)
public void setTimeoutInSeconds(int seconds)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

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