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


java.lang.Object
   org.springframework.orm.hibernate3.AbstractSessionFactoryBean

All known Subclasses:   org.springframework.orm.hibernate3.LocalSessionFactoryBean,
AbstractSessionFactoryBean
abstract public class AbstractSessionFactoryBean implements FactoryBean,InitializingBean,DisposableBean,PersistenceExceptionTranslator(Code)
Abstract org.springframework.beans.factory.FactoryBean that creates a Hibernate org.hibernate.SessionFactory within a Spring application context. Supports building a transaction-aware SessionFactory proxy that exposes a Spring-managed transactional Session as "current Session".

This class also implements the org.springframework.dao.support.PersistenceExceptionTranslator interface, as autodetected by Spring's org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor , for AOP-based translation of native exceptions to Spring DataAccessExceptions. Hence, the presence of e.g. LocalSessionFactoryBean automatically enables a PersistenceExceptionTranslationPostProcessor to translate Hibernate exceptions.

This class mainly serves as common base class for LocalSessionFactoryBean . For details on typical SessionFactory setup, see the LocalSessionFactoryBean javadoc.
author:
   Juergen Hoeller
since:
   2.0
See Also:   AbstractSessionFactoryBean.setExposeTransactionAwareSessionFactory
See Also:   org.hibernate.SessionFactory.getCurrentSession
See Also:   org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor



Field Summary
final protected  Loglogger
    


Method Summary
public  voidafterPropertiesSet()
     Build and expose the SessionFactory.
protected  voidafterSessionFactoryCreation()
     Hook that allows post-processing after the SessionFactory has been successfully created.
protected  voidbeforeSessionFactoryDestruction()
     Hook that allows shutdown processing before the SessionFactory will be closed.
abstract protected  SessionFactorybuildSessionFactory()
     Build the underlying Hibernate SessionFactory.
protected  DataAccessExceptionconvertHibernateAccessException(HibernateException ex)
     Convert the given HibernateException to an appropriate exception from the org.springframework.dao hierarchy.
public  voiddestroy()
     Close the SessionFactory on bean factory shutdown.
public  ObjectgetObject()
     Return the singleton SessionFactory.
public  ClassgetObjectType()
    
final protected  SessionFactorygetSessionFactory()
     Return the exposed SessionFactory.
protected  SessionFactorygetTransactionAwareSessionFactoryProxy(SessionFactory target)
     Wrap the given SessionFactory with a proxy that delegates every method call to it but delegates getCurrentSession calls to SessionFactoryUtils, for participating in Spring-managed transactions.
protected  booleanisExposeTransactionAwareSessionFactory()
     Return whether to expose a transaction-aware proxy for the SessionFactory.
public  booleanisSingleton()
    
public  voidsetExposeTransactionAwareSessionFactory(boolean exposeTransactionAwareSessionFactory)
     Set whether to expose a transaction-aware proxy for the SessionFactory, returning the Session that's associated with the current Spring-managed transaction on getCurrentSession(), if any.

Default is "true", letting data access code work with the plain Hibernate SessionFactory and its getCurrentSession() method, while still being able to participate in current Spring-managed transactions: with any transaction management strategy, either local or JTA / EJB CMT, and any transaction synchronization mechanism, either Spring or JTA. Furthermore, getCurrentSession() will also seamlessly work with a request-scoped Session managed by OpenSessionInViewFilter/Interceptor.

Turn this flag off to expose the plain Hibernate SessionFactory with Hibernate's default getCurrentSession() behavior, where Hibernate 3.0.x only supports plain JTA synchronization.

public  voidsetJdbcExceptionTranslator(SQLExceptionTranslator jdbcExceptionTranslator)
     Set the JDBC exception translator for the SessionFactory, exposed via the PersistenceExceptionTranslator interface.
public  DataAccessExceptiontranslateExceptionIfPossible(RuntimeException ex)
     Implementation of the PersistenceExceptionTranslator interface, as autodetected by Spring's PersistenceExceptionTranslationPostProcessor.
protected  SessionFactorywrapSessionFactoryIfNecessary(SessionFactory rawSf)
     Wrap the given SessionFactory with a transaction-aware proxy, if demanded.

Field Detail
logger
final protected Log logger(Code)
Logger available to subclasses





Method Detail
afterPropertiesSet
public void afterPropertiesSet() throws Exception(Code)
Build and expose the SessionFactory.
See Also:   AbstractSessionFactoryBean.buildSessionFactory()
See Also:   AbstractSessionFactoryBean.wrapSessionFactoryIfNecessary



afterSessionFactoryCreation
protected void afterSessionFactoryCreation() throws Exception(Code)
Hook that allows post-processing after the SessionFactory has been successfully created. The SessionFactory is already available through getSessionFactory() at this point.

This implementation is empty.
See Also:   AbstractSessionFactoryBean.getSessionFactory()




beforeSessionFactoryDestruction
protected void beforeSessionFactoryDestruction()(Code)
Hook that allows shutdown processing before the SessionFactory will be closed. The SessionFactory is still available through getSessionFactory() at this point.

This implementation is empty.
See Also:   AbstractSessionFactoryBean.getSessionFactory()




buildSessionFactory
abstract protected SessionFactory buildSessionFactory() throws Exception(Code)
Build the underlying Hibernate SessionFactory. the raw SessionFactory (potentially to be wrapped with atransaction-aware proxy before it is exposed to the application)
throws:
  Exception - in case of initialization failure



convertHibernateAccessException
protected DataAccessException convertHibernateAccessException(HibernateException ex)(Code)
Convert the given HibernateException to an appropriate exception from the org.springframework.dao hierarchy.

Will automatically apply a specified SQLExceptionTranslator to a Hibernate JDBCException, else rely on Hibernate's default translation.
Parameters:
  ex - HibernateException that occured a corresponding DataAccessException
See Also:   SessionFactoryUtils.convertHibernateAccessException
See Also:   AbstractSessionFactoryBean.setJdbcExceptionTranslator




destroy
public void destroy() throws HibernateException(Code)
Close the SessionFactory on bean factory shutdown.



getObject
public Object getObject()(Code)
Return the singleton SessionFactory.



getObjectType
public Class getObjectType()(Code)



getSessionFactory
final protected SessionFactory getSessionFactory()(Code)
Return the exposed SessionFactory.
throws:
  IllegalStateException - if the SessionFactory has not been initialized yet



getTransactionAwareSessionFactoryProxy
protected SessionFactory getTransactionAwareSessionFactoryProxy(SessionFactory target)(Code)
Wrap the given SessionFactory with a proxy that delegates every method call to it but delegates getCurrentSession calls to SessionFactoryUtils, for participating in Spring-managed transactions.
Parameters:
  target - the original SessionFactory to wrap the wrapped SessionFactory
See Also:   org.hibernate.SessionFactory.getCurrentSession
See Also:   SessionFactoryUtils.doGetSession(org.hibernate.SessionFactoryboolean)



isExposeTransactionAwareSessionFactory
protected boolean isExposeTransactionAwareSessionFactory()(Code)
Return whether to expose a transaction-aware proxy for the SessionFactory.



isSingleton
public boolean isSingleton()(Code)



setExposeTransactionAwareSessionFactory
public void setExposeTransactionAwareSessionFactory(boolean exposeTransactionAwareSessionFactory)(Code)
Set whether to expose a transaction-aware proxy for the SessionFactory, returning the Session that's associated with the current Spring-managed transaction on getCurrentSession(), if any.

Default is "true", letting data access code work with the plain Hibernate SessionFactory and its getCurrentSession() method, while still being able to participate in current Spring-managed transactions: with any transaction management strategy, either local or JTA / EJB CMT, and any transaction synchronization mechanism, either Spring or JTA. Furthermore, getCurrentSession() will also seamlessly work with a request-scoped Session managed by OpenSessionInViewFilter/Interceptor.

Turn this flag off to expose the plain Hibernate SessionFactory with Hibernate's default getCurrentSession() behavior, where Hibernate 3.0.x only supports plain JTA synchronization. On Hibernate 3.1+, such a plain SessionFactory will by default have a SpringSessionContext registered to nevertheless provide Spring-managed Sessions; this can be overridden through the corresponding Hibernate property "hibernate.current_session_context_class".
See Also:   org.hibernate.SessionFactory.getCurrentSession
See Also:   org.springframework.transaction.jta.JtaTransactionManager
See Also:   HibernateTransactionManager
See Also:   org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
See Also:   org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor
See Also:   SpringSessionContext




setJdbcExceptionTranslator
public void setJdbcExceptionTranslator(SQLExceptionTranslator jdbcExceptionTranslator)(Code)
Set the JDBC exception translator for the SessionFactory, exposed via the PersistenceExceptionTranslator interface.

Applied to any SQLException root cause of a Hibernate JDBCException, overriding Hibernate's default SQLException translation (which is based on Hibernate's Dialect for a specific target database).
Parameters:
  jdbcExceptionTranslator - the exception translator
See Also:   java.sql.SQLException
See Also:   org.hibernate.JDBCException
See Also:   org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator
See Also:   org.springframework.jdbc.support.SQLStateSQLExceptionTranslator
See Also:   org.springframework.dao.support.PersistenceExceptionTranslator




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 HibernateException; else returns null to indicate an unknown exception.
See Also:   org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor
See Also:   AbstractSessionFactoryBean.convertHibernateAccessException




wrapSessionFactoryIfNecessary
protected SessionFactory wrapSessionFactoryIfNecessary(SessionFactory rawSf)(Code)
Wrap the given SessionFactory with a transaction-aware proxy, if demanded.
Parameters:
  rawSf - the raw SessionFactory as built by buildSessionFactory() the SessionFactory reference to expose
See Also:   AbstractSessionFactoryBean.buildSessionFactory()
See Also:   AbstractSessionFactoryBean.getTransactionAwareSessionFactoryProxy



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.