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


org.springframework.orm.jdo.JdoDialect

All known Subclasses:   org.springframework.orm.jdo.DefaultJdoDialect,
JdoDialect
public interface JdoDialect (Code)
SPI strategy that encapsulates certain functionality that standard JDO 1.0 does not offer despite being relevant in the context of O/R mapping, such as access to the underlying JDBC Connection and explicit flushing of changes to the database. Also defines various further hooks that even go beyond standard JDO 2.0.

To be implemented for specific JDO providers such as JPOX, Kodo, Lido, Versant Open Access. Almost every O/R-based JDO provider offers proprietary means to access the underlying JDBC Connection and to explicitly flush changes; hence, this would be the minimum functionality level that should be supported.

JDO 2.0 defines standard ways for most of the functionality covered here. Hence, Spring's DefaultJdoDialect uses the corresponding JDO 2.0 methods by default, to be overridden in a vendor-specific fashion if necessary. Vendor-specific subclasses of DefaultJdoDialect are still required for special transaction semantics and more sophisticated exception translation (if needed).

In general, it is recommended to derive from DefaultJdoDialect instead of implementing this interface directly. This allows for inheriting common behavior (present and future) from DefaultJdoDialect, only overriding specific hooks to plug in concrete vendor-specific behavior.
author:
   Juergen Hoeller
since:
   02.11.2003
See Also:   JdoTransactionManager.setJdoDialect
See Also:   JdoAccessor.setJdoDialect
See Also:   DefaultJdoDialect





Method Summary
 voidapplyQueryTimeout(Query query, int timeout)
     Apply the given timeout to the given JDO query object.
 ObjectattachCopy(PersistenceManager pm, Object detachedEntity)
     Reattach the given detached instance (for example, a web form object) with the current JDO transaction, merging its changes into the current persistence instance that represents the corresponding entity.
 CollectionattachCopyAll(PersistenceManager pm, Collection detachedEntities)
     Reattach the given detached instances (for example, web form objects) with the current JDO transaction, merging their changes into the current persistence instances that represent the corresponding entities.
 ObjectbeginTransaction(Transaction transaction, TransactionDefinition definition)
     Begin the given JDO transaction, applying the semantics specified by the given Spring transaction definition (in particular, an isolation level and a timeout).
 voidcleanupTransaction(Object transactionData)
     Clean up the transaction via the given transaction data. Invoked by JdoTransactionManager on transaction cleanup.

An implementation can, for example, reset read-only flag and isolation level of the underlying JDBC Connection.

 ObjectdetachCopy(PersistenceManager pm, Object entity)
     Detach a copy of the given persistent instance from the current JDO transaction, for use outside a JDO transaction (for example, as web form object).
 CollectiondetachCopyAll(PersistenceManager pm, Collection entities)
     Detach copies of the given persistent instances from the current JDO transaction, for use outside a JDO transaction (for example, as web form objects).
 voidflush(PersistenceManager pm)
     Flush the given PersistenceManager, i.e.
 ConnectionHandlegetJdbcConnection(PersistenceManager pm, boolean readOnly)
     Retrieve the JDBC Connection that the given JDO PersistenceManager uses underneath, if accessing a relational database.
 QuerynewNamedQuery(PersistenceManager pm, Class entityClass, String queryName)
     Create a new Query object for the given named query.
 voidreleaseJdbcConnection(ConnectionHandle conHandle, PersistenceManager pm)
     Release the given JDBC Connection, which has originally been retrieved via getJdbcConnection.
 DataAccessExceptiontranslateException(JDOException ex)
     Translate the given JDOException to a corresponding exception from Spring's generic DataAccessException hierarchy.



Method Detail
applyQueryTimeout
void applyQueryTimeout(Query query, int timeout) throws JDOException(Code)
Apply the given timeout to the given JDO query object.

Invoked by JdoTemplate with the remaining time of a specified transaction timeout, if any.
Parameters:
  query - the JDO query object to apply the timeout to
Parameters:
  timeout - the timeout value to apply
throws:
  JDOException - if thrown by JDO methods
See Also:   JdoTemplate.prepareQuery




attachCopy
Object attachCopy(PersistenceManager pm, Object detachedEntity) throws JDOException(Code)
Reattach the given detached instance (for example, a web form object) with the current JDO transaction, merging its changes into the current persistence instance that represents the corresponding entity.
Parameters:
  pm - the current JDO PersistenceManager
Parameters:
  detachedEntity - the detached instance to attach the corresponding persistent instance
throws:
  JDOException - in case of errors
See Also:   javax.jdo.PersistenceManager.makePersistent(Object)



attachCopyAll
Collection attachCopyAll(PersistenceManager pm, Collection detachedEntities) throws JDOException(Code)
Reattach the given detached instances (for example, web form objects) with the current JDO transaction, merging their changes into the current persistence instances that represent the corresponding entities.
Parameters:
  pm - the current JDO PersistenceManager
Parameters:
  detachedEntities - the detached instances to reattach the corresponding persistent instances
throws:
  JDOException - in case of errors
See Also:   javax.jdo.PersistenceManager.makePersistentAll(java.util.Collection)



beginTransaction
Object beginTransaction(Transaction transaction, TransactionDefinition definition) throws JDOException, SQLException, TransactionException(Code)
Begin the given JDO transaction, applying the semantics specified by the given Spring transaction definition (in particular, an isolation level and a timeout). Invoked by JdoTransactionManager on transaction begin.

An implementation can configure the JDO Transaction object and then invoke begin, or invoke a special begin method that takes, for example, an isolation level.

An implementation can also apply read-only flag and isolation level to the underlying JDBC Connection before beginning the transaction. In that case, a transaction data object can be returned that holds the previous isolation level (and possibly other data), to be reset in cleanupTransaction.

Implementations can also use the Spring transaction name, as exposed by the passed-in TransactionDefinition, to optimize for specific data access use cases (effectively using the current transaction name as use case identifier).
Parameters:
  transaction - the JDO transaction to begin
Parameters:
  definition - the Spring transaction definition that defines semantics an arbitrary object that holds transaction data, if any(to be passed into cleanupTransaction)
throws:
  JDOException - if thrown by JDO methods
throws:
  SQLException - if thrown by JDBC methods
throws:
  TransactionException - in case of invalid arguments
See Also:   JdoDialect.cleanupTransaction
See Also:   javax.jdo.Transaction.begin
See Also:   org.springframework.jdbc.datasource.DataSourceUtils.prepareConnectionForTransaction




cleanupTransaction
void cleanupTransaction(Object transactionData)(Code)
Clean up the transaction via the given transaction data. Invoked by JdoTransactionManager on transaction cleanup.

An implementation can, for example, reset read-only flag and isolation level of the underlying JDBC Connection. Furthermore, an exposed data access use case can be reset here.
Parameters:
  transactionData - arbitrary object that holds transaction data, if any(as returned by beginTransaction)
See Also:   JdoDialect.beginTransaction
See Also:   org.springframework.jdbc.datasource.DataSourceUtils.resetConnectionAfterTransaction




detachCopy
Object detachCopy(PersistenceManager pm, Object entity) throws JDOException(Code)
Detach a copy of the given persistent instance from the current JDO transaction, for use outside a JDO transaction (for example, as web form object).
Parameters:
  pm - the current JDO PersistenceManager
Parameters:
  entity - the persistent instance to detach
throws:
  JDOException - in case of errors
See Also:   javax.jdo.PersistenceManager.detachCopy(Object)



detachCopyAll
Collection detachCopyAll(PersistenceManager pm, Collection entities) throws JDOException(Code)
Detach copies of the given persistent instances from the current JDO transaction, for use outside a JDO transaction (for example, as web form objects).
Parameters:
  pm - the current JDO PersistenceManager
Parameters:
  entities - the persistent instances to detach
throws:
  JDOException - in case of errors
See Also:   javax.jdo.PersistenceManager.detachCopyAll(java.util.Collection)



flush
void flush(PersistenceManager pm) throws JDOException(Code)
Flush the given PersistenceManager, i.e. flush all changes (that have been applied to persistent objects) to the underlying database. This method will just get invoked when eager flushing is actually necessary, for example when JDBC access code needs to see changes within the same transaction.
Parameters:
  pm - the current JDO PersistenceManager
throws:
  JDOException - in case of errors
See Also:   JdoAccessor.setFlushEager



getJdbcConnection
ConnectionHandle getJdbcConnection(PersistenceManager pm, boolean readOnly) throws JDOException, SQLException(Code)
Retrieve the JDBC Connection that the given JDO PersistenceManager uses underneath, if accessing a relational database. This method will just get invoked if actually needing access to the underlying JDBC Connection, usually within an active JDO transaction (for example, by JdoTransactionManager). The returned handle will be passed into the releaseJdbcConnection method when not needed anymore.

This strategy is necessary as JDO 1.0 does not provide a standard way to retrieve the underlying JDBC Connection (due to the fact that a JDO provider might not work with a relational database at all).

Implementations are encouraged to return an unwrapped Connection object, i.e. the Connection as they got it from the connection pool. This makes it easier for application code to get at the underlying native JDBC Connection, like an OracleConnection, which is sometimes necessary for LOB handling etc. We assume that calling code knows how to properly handle the returned Connection object.

In a simple case where the returned Connection will be auto-closed with the PersistenceManager or can be released via the Connection object itself, an implementation can return a SimpleConnectionHandle that just contains the Connection. If some other object is needed in releaseJdbcConnection, an implementation should use a special handle that references that other object.
Parameters:
  pm - the current JDO PersistenceManager
Parameters:
  readOnly - whether the Connection is only needed for read-only purposes a handle for the JDBC Connection, to be passed intoreleaseJdbcConnection, or nullif no JDBC Connection can be retrieved
throws:
  JDOException - if thrown by JDO methods
throws:
  SQLException - if thrown by JDBC methods
See Also:   JdoDialect.releaseJdbcConnection
See Also:   org.springframework.jdbc.datasource.ConnectionHandle.getConnection
See Also:   org.springframework.jdbc.datasource.SimpleConnectionHandle
See Also:   JdoTransactionManager.setDataSource
See Also:   org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor




newNamedQuery
Query newNamedQuery(PersistenceManager pm, Class entityClass, String queryName) throws JDOException(Code)
Create a new Query object for the given named query.
Parameters:
  pm - the current JDO PersistenceManager
Parameters:
  entityClass - a persistent class
Parameters:
  queryName - the name of the query the Query object
throws:
  JDOException - in case of errors
See Also:   javax.jdo.PersistenceManager.newNamedQuery(ClassString)



releaseJdbcConnection
void releaseJdbcConnection(ConnectionHandle conHandle, PersistenceManager pm) throws JDOException, SQLException(Code)
Release the given JDBC Connection, which has originally been retrieved via getJdbcConnection. This should be invoked in any case, to allow for proper release of the retrieved Connection handle.

An implementation might simply do nothing, if the Connection returned by getJdbcConnection will be implicitly closed when the JDO transaction completes or when the PersistenceManager is closed.
Parameters:
  conHandle - the JDBC Connection handle to release
Parameters:
  pm - the current JDO PersistenceManager
throws:
  JDOException - if thrown by JDO methods
throws:
  SQLException - if thrown by JDBC methods
See Also:   JdoDialect.getJdbcConnection




translateException
DataAccessException translateException(JDOException ex)(Code)
Translate the given JDOException to a corresponding exception from Spring's generic DataAccessException hierarchy. An implementation should apply PersistenceManagerFactoryUtils' standard exception translation if can't do anything more specific.

Of particular importance is the correct translation to DataIntegrityViolationException, for example on constraint violation. Unfortunately, standard JDO does not allow for portable detection of this.

Can use a SQLExceptionTranslator for translating underlying SQLExceptions in a database-specific fashion.
Parameters:
  ex - the JDOException thrown the corresponding DataAccessException (must not be null)
See Also:   JdoAccessor.convertJdoAccessException
See Also:   JdoTransactionManager.convertJdoAccessException
See Also:   PersistenceManagerFactoryUtils.convertJdoAccessException
See Also:   org.springframework.dao.DataIntegrityViolationException
See Also:   org.springframework.jdbc.support.SQLExceptionTranslator




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