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


org.springframework.orm.jpa.JpaDialect

All known Subclasses:   org.springframework.orm.jpa.DefaultJpaDialect,
JpaDialect
public interface JpaDialect extends PersistenceExceptionTranslator(Code)
SPI strategy that encapsulates certain functionality that standard JPA 1.0 does not offer, such as access to the underlying JDBC Connection. This strategy is mainly intended for standalone usage of a JPA provider; most of its functionality is not relevant when running with JTA transactions.

Also allows for the provision of value-added methods for portable yet more capable EntityManager and EntityManagerFactory subinterfaces offered by Spring.

In general, it is recommended to derive from DefaultJpaDialect instead of implementing this interface directly. This allows for inheriting common behavior (present and future) from DefaultJpaDialect, only overriding specific hooks to plug in concrete vendor-specific behavior.
author:
   Juergen Hoeller
author:
   Rod Johnson
since:
   2.0
See Also:   DefaultJpaDialect
See Also:   JpaAccessor.setJpaDialect
See Also:   JpaTransactionManager.setJpaDialect
See Also:   JpaVendorAdapter.getJpaDialect
See Also:   AbstractEntityManagerFactoryBean.setJpaDialect
See Also:   AbstractEntityManagerFactoryBean.setJpaVendorAdapter





Method Summary
 ObjectbeginTransaction(EntityManager entityManager, TransactionDefinition definition)
     Begin the given JPA 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 JpaTransactionManager on transaction cleanup.

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

 EntityManagerFactoryPlusOperationsgetEntityManagerFactoryPlusOperations(EntityManagerFactory rawEntityManager)
     Return an EntityManagerFactoryPlusOperations implementation for the given raw EntityManagerFactory.
 EntityManagerPlusOperationsgetEntityManagerPlusOperations(EntityManager rawEntityManager)
     Return an EntityManagerPlusOperations implementation for the given raw EntityManager.
 ConnectionHandlegetJdbcConnection(EntityManager entityManager, boolean readOnly)
     Retrieve the JDBC Connection that the given JPA EntityManager uses underneath, if accessing a relational database.
 voidreleaseJdbcConnection(ConnectionHandle conHandle, EntityManager entityManager)
     Release the given JDBC Connection, which has originally been retrieved via getJdbcConnection.
 booleansupportsEntityManagerFactoryPlusOperations()
     Return whether the EntityManagerFactoryPlus(Operations) interface is supported by this provider.
 booleansupportsEntityManagerPlusOperations()
     Return whether the EntityManagerPlus(Operations) interface is supported by this provider.



Method Detail
beginTransaction
Object beginTransaction(EntityManager entityManager, TransactionDefinition definition) throws PersistenceException, SQLException, TransactionException(Code)
Begin the given JPA transaction, applying the semantics specified by the given Spring transaction definition (in particular, an isolation level and a timeout). Invoked by JpaTransactionManager on transaction begin.

An implementation can configure the JPA 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:
  entityManager - the EntityManager to begin a JPA transaction on
Parameters:
  definition - the Spring transaction definition that defines semantics an arbitrary object that holds transaction data, if any(to be passed into cleanupTransaction)
throws:
  javax.persistence.PersistenceException - if thrown by JPA methods
throws:
  java.sql.SQLException - if thrown by JDBC methods
throws:
  org.springframework.transaction.TransactionException - in case of invalid arguments
See Also:   JpaDialect.cleanupTransaction
See Also:   javax.persistence.EntityTransaction.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 JpaTransactionManager 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:   JpaDialect.beginTransaction
See Also:   org.springframework.jdbc.datasource.DataSourceUtils.resetConnectionAfterTransaction




getEntityManagerFactoryPlusOperations
EntityManagerFactoryPlusOperations getEntityManagerFactoryPlusOperations(EntityManagerFactory rawEntityManager)(Code)
Return an EntityManagerFactoryPlusOperations implementation for the given raw EntityManagerFactory. This operations object can be used to serve the additional operations behind a proxy that implements the EntityManagerFactoryPlus interface.
Parameters:
  rawEntityManager - the raw provider-specific EntityManagerFactory the EntityManagerFactoryPlusOperations implementation



getEntityManagerPlusOperations
EntityManagerPlusOperations getEntityManagerPlusOperations(EntityManager rawEntityManager)(Code)
Return an EntityManagerPlusOperations implementation for the given raw EntityManager. This operations object can be used to serve the additional operations behind a proxy that implements the EntityManagerPlus interface.
Parameters:
  rawEntityManager - the raw provider-specific EntityManagerFactory the EntityManagerFactoryPlusOperations implementation



getJdbcConnection
ConnectionHandle getJdbcConnection(EntityManager entityManager, boolean readOnly) throws PersistenceException, SQLException(Code)
Retrieve the JDBC Connection that the given JPA EntityManager 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 JPA transaction (for example, by JpaTransactionManager). The returned handle will be passed into the releaseJdbcConnection method when not needed anymore.

This strategy is necessary as JPA 1.0 does not provide a standard way to retrieve the underlying JDBC Connection (due to the fact that a JPA implementation 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 EntityManager 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:
  entityManager - the current JPA EntityManager
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:
  javax.persistence.PersistenceException - if thrown by JPA methods
throws:
  java.sql.SQLException - if thrown by JDBC methods
See Also:   JpaDialect.releaseJdbcConnection
See Also:   org.springframework.jdbc.datasource.ConnectionHandle.getConnection
See Also:   org.springframework.jdbc.datasource.SimpleConnectionHandle
See Also:   JpaTransactionManager.setDataSource
See Also:   org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor




releaseJdbcConnection
void releaseJdbcConnection(ConnectionHandle conHandle, EntityManager entityManager) throws PersistenceException, 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 JPA transaction completes or when the EntityManager is closed.
Parameters:
  conHandle - the JDBC Connection handle to release
Parameters:
  entityManager - the current JPA EntityManager
throws:
  javax.persistence.PersistenceException - if thrown by JPA methods
throws:
  java.sql.SQLException - if thrown by JDBC methods
See Also:   JpaDialect.getJdbcConnection




supportsEntityManagerFactoryPlusOperations
boolean supportsEntityManagerFactoryPlusOperations()(Code)
Return whether the EntityManagerFactoryPlus(Operations) interface is supported by this provider.
See Also:   EntityManagerFactoryPlusOperations
See Also:   EntityManagerFactoryPlus



supportsEntityManagerPlusOperations
boolean supportsEntityManagerPlusOperations()(Code)
Return whether the EntityManagerPlus(Operations) interface is supported by this provider.
See Also:   EntityManagerPlusOperations
See Also:   EntityManagerPlus



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