Java Doc for DefaultJdoDialect.java in  » J2EE » spring-framework-2.5 » org » springframework » orm » jdo » 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.5 » org.springframework.orm.jdo 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.orm.jdo.DefaultJdoDialect

DefaultJdoDialect
public class DefaultJdoDialect implements JdoDialect,PersistenceExceptionTranslator(Code)
Default implementation of the JdoDialect interface. Updated to build on JDO 2.0 or higher, as of Spring 2.5. Used as default dialect by JdoAccessor and JdoTransactionManager .

Simply begins a standard JDO transaction in beginTransaction. Returns a handle for a JDO2 DataStoreConnection on getJdbcConnection. Calls the corresponding JDO2 PersistenceManager operation on flush Ignores a given query timeout in applyQueryTimeout. Uses a Spring SQLExceptionTranslator for exception translation, if applicable.

Note that, even with JDO2, vendor-specific subclasses are still necessary for special transaction semantics and more sophisticated exception translation. Furthermore, vendor-specific subclasses are encouraged to expose the native JDBC Connection on getJdbcConnection, rather than JDO2's wrapper handle.

This class also implements the PersistenceExceptionTranslator interface, as autodetected by Spring's PersistenceExceptionTranslationPostProcessor, for AOP-based translation of native exceptions to Spring DataAccessExceptions. Hence, the presence of a standard DefaultJdoDialect bean automatically enables a PersistenceExceptionTranslationPostProcessor to translate JDO exceptions.
author:
   Juergen Hoeller
since:
   1.1
See Also:   DefaultJdoDialect.setJdbcExceptionTranslator
See Also:   JdoAccessor.setJdoDialect
See Also:   JdoTransactionManager.setJdoDialect
See Also:   org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor



Field Summary
final protected  Loglogger
    

Constructor Summary
public  DefaultJdoDialect()
     Create a new DefaultJdoDialect.
 DefaultJdoDialect(Object connectionFactory)
     Create a new DefaultJdoDialect.

Method Summary
public  voidapplyQueryTimeout(Query query, int remainingTimeInSeconds)
     This implementation logs a warning that it cannot apply a query timeout.
public  ObjectbeginTransaction(Transaction transaction, TransactionDefinition definition)
     This implementation invokes the standard JDO Transaction.begin method.
public  voidcleanupTransaction(Object transactionData)
     This implementation does nothing, as the default beginTransaction implementation does not require any cleanup.
protected  StringextractSqlStringFromException(JDOException ex)
     Template method for extracting a SQL String from the given exception.

Default implementation always returns null.

public  voidflush(PersistenceManager pm)
     This implementation delegates to JDO 2.0's flush method.
public  ConnectionHandlegetJdbcConnection(PersistenceManager pm, boolean readOnly)
     This implementation returns a DataStoreConnectionHandle for JDO2, which will also work on JDO1 until actually accessing the JDBC Connection.

For pre-JDO2 implementations, override this method to return the Connection through the corresponding vendor-specific mechanism, or null if the Connection is not retrievable.

NOTE: A JDO2 DataStoreConnection is always a wrapper, never the native JDBC Connection.

public  SQLExceptionTranslatorgetJdbcExceptionTranslator()
     Return the JDBC exception translator for this dialect, if any.
public  voidreleaseJdbcConnection(ConnectionHandle conHandle, PersistenceManager pm)
     This implementation does nothing, assuming that the Connection will implicitly be closed with the PersistenceManager.
public  voidsetJdbcExceptionTranslator(SQLExceptionTranslator jdbcExceptionTranslator)
     Set the JDBC exception translator for this dialect.
public  DataAccessExceptiontranslateException(JDOException ex)
     This implementation delegates to PersistenceManagerFactoryUtils.
public  DataAccessExceptiontranslateExceptionIfPossible(RuntimeException ex)
     Implementation of the PersistenceExceptionTranslator interface, as autodetected by Spring's PersistenceExceptionTranslationPostProcessor.

Field Detail
logger
final protected Log logger(Code)




Constructor Detail
DefaultJdoDialect
public DefaultJdoDialect()(Code)
Create a new DefaultJdoDialect.



DefaultJdoDialect
DefaultJdoDialect(Object connectionFactory)(Code)
Create a new DefaultJdoDialect.
Parameters:
  connectionFactory - the connection factory of the JDO PersistenceManagerFactory,which is used to initialize the default JDBC exception translator
See Also:   javax.jdo.PersistenceManagerFactory.getConnectionFactory
See Also:   PersistenceManagerFactoryUtils.newJdbcExceptionTranslator(Object)




Method Detail
applyQueryTimeout
public void applyQueryTimeout(Query query, int remainingTimeInSeconds) throws JDOException(Code)
This implementation logs a warning that it cannot apply a query timeout.



beginTransaction
public Object beginTransaction(Transaction transaction, TransactionDefinition definition) throws JDOException, SQLException, TransactionException(Code)
This implementation invokes the standard JDO Transaction.begin method. Throws an InvalidIsolationLevelException if a non-default isolation level is set.
See Also:   javax.jdo.Transaction.begin
See Also:   org.springframework.transaction.InvalidIsolationLevelException



cleanupTransaction
public void cleanupTransaction(Object transactionData)(Code)
This implementation does nothing, as the default beginTransaction implementation does not require any cleanup.
See Also:   DefaultJdoDialect.beginTransaction



extractSqlStringFromException
protected String extractSqlStringFromException(JDOException ex)(Code)
Template method for extracting a SQL String from the given exception.

Default implementation always returns null. Can be overridden in subclasses to extract SQL Strings for vendor-specific exception classes.
Parameters:
  ex - the JDOException, containing a SQLException the SQL String, or null if none found




flush
public void flush(PersistenceManager pm) throws JDOException(Code)
This implementation delegates to JDO 2.0's flush method.

To be overridden for pre-JDO2 implementations, using the corresponding vendor-specific mechanism there.
See Also:   javax.jdo.PersistenceManager.flush




getJdbcConnection
public ConnectionHandle getJdbcConnection(PersistenceManager pm, boolean readOnly) throws JDOException, SQLException(Code)
This implementation returns a DataStoreConnectionHandle for JDO2, which will also work on JDO1 until actually accessing the JDBC Connection.

For pre-JDO2 implementations, override this method to return the Connection through the corresponding vendor-specific mechanism, or null if the Connection is not retrievable.

NOTE: A JDO2 DataStoreConnection is always a wrapper, never the native JDBC Connection. If you need access to the native JDBC Connection (or the connection pool handle, to be unwrapped via a Spring NativeJdbcExtractor), override this method to return the native Connection through the corresponding vendor-specific mechanism.

A JDO2 DataStoreConnection is only "borrowed" from the PersistenceManager: it needs to be returned as early as possible. Effectively, JDO2 requires the fetched Connection to be closed before continuing PersistenceManager work. For this reason, the exposed ConnectionHandle eagerly releases its JDBC Connection at the end of each JDBC data access operation (that is, on DataSourceUtils.releaseConnection).
See Also:   javax.jdo.PersistenceManager.getDataStoreConnection
See Also:   org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor
See Also:   org.springframework.jdbc.datasource.DataSourceUtils.releaseConnection




getJdbcExceptionTranslator
public SQLExceptionTranslator getJdbcExceptionTranslator()(Code)
Return the JDBC exception translator for this dialect, if any.



releaseJdbcConnection
public void releaseJdbcConnection(ConnectionHandle conHandle, PersistenceManager pm) throws JDOException, SQLException(Code)
This implementation does nothing, assuming that the Connection will implicitly be closed with the PersistenceManager.

If the JDO provider returns a Connection handle that it expects the application to close, the dialect needs to invoke Connection.close here.
See Also:   java.sql.Connection.close




setJdbcExceptionTranslator
public void setJdbcExceptionTranslator(SQLExceptionTranslator jdbcExceptionTranslator)(Code)
Set the JDBC exception translator for this dialect.

Applied to any SQLException root cause of a JDOException, if specified. The default is to rely on the JDO provider's native exception translation.
Parameters:
  jdbcExceptionTranslator - exception translator
See Also:   java.sql.SQLException
See Also:   javax.jdo.JDOException.getCause
See Also:   org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator
See Also:   org.springframework.jdbc.support.SQLStateSQLExceptionTranslator




translateException
public DataAccessException translateException(JDOException ex)(Code)
This implementation delegates to PersistenceManagerFactoryUtils.
See Also:   PersistenceManagerFactoryUtils.convertJdoAccessException



translateExceptionIfPossible
public DataAccessException translateExceptionIfPossible(RuntimeException ex)(Code)
Implementation of the PersistenceExceptionTranslator interface, as autodetected by Spring's PersistenceExceptionTranslationPostProcessor.

Converts the exception if it is a JDOException, using this JdoDialect. Else returns null to indicate an unknown exception.
See Also:   org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor
See Also:   DefaultJdoDialect.translateException




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.