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


java.lang.Object
   org.springframework.orm.toplink.LocalSessionFactory
      org.springframework.orm.toplink.LocalSessionFactoryBean

LocalSessionFactoryBean
public class LocalSessionFactoryBean extends LocalSessionFactory implements FactoryBean,BeanClassLoaderAware,InitializingBean,DisposableBean,PersistenceExceptionTranslator(Code)
org.springframework.beans.factory.FactoryBean that creates a TopLink SessionFactory . This is the usual way to set up a shared TopLink SessionFactory in a Spring application context; the SessionFactory can then be passed to TopLink-based DAOs via dependency injection.

See the base class LocalSessionFactory for configuration details.

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 a LocalSessionFactoryBean automatically enables a PersistenceExceptionTranslationPostProcessor to translate TopLink exceptions.

If your DAOs expect to receive a raw TopLink Session, consider defining a org.springframework.orm.toplink.support.TransactionAwareSessionAdapter in front of this bean. This adapter will provide a TopLink Session rather than a SessionFactory as bean reference. Your DAOs can then, for example, access the currently active Session and UnitOfWork via Session.getActiveSession() and Session.getActiveUnitOfWork(), respectively. Note that you can still access the SessionFactory as well, by defining a bean reference that points directly at the LocalSessionFactoryBean.
author:
   Juergen Hoeller
since:
   1.2
See Also:   LocalSessionFactory
See Also:   org.springframework.orm.toplink.support.TransactionAwareSessionAdapter
See Also:   org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor





Method Summary
public  voidafterPropertiesSet()
    
public  DataAccessExceptionconvertTopLinkAccessException(TopLinkException ex)
     Convert the given TopLinkException to an appropriate exception from the org.springframework.dao hierarchy.
public  voiddestroy()
    
public  SQLExceptionTranslatorgetJdbcExceptionTranslator()
     Return the JDBC exception translator for this instance, if any.
public  ObjectgetObject()
    
public  ClassgetObjectType()
    
public  booleanisSingleton()
    
public  voidsetBeanClassLoader(ClassLoader classLoader)
     Sets the given bean ClassLoader as TopLink Session ClassLoader.
public  voidsetJdbcExceptionTranslator(SQLExceptionTranslator jdbcExceptionTranslator)
     Set the JDBC exception translator for this SessionFactory.
public  DataAccessExceptiontranslateExceptionIfPossible(RuntimeException ex)
     Implementation of the PersistenceExceptionTranslator interface, as autodetected by Spring's PersistenceExceptionTranslationPostProcessor.



Method Detail
afterPropertiesSet
public void afterPropertiesSet() throws TopLinkException(Code)



convertTopLinkAccessException
public DataAccessException convertTopLinkAccessException(TopLinkException ex)(Code)
Convert the given TopLinkException to an appropriate exception from the org.springframework.dao hierarchy.

Will automatically apply a specified SQLExceptionTranslator to a TopLink DatabaseException, else rely on TopLink's default translation.
Parameters:
  ex - TopLinkException that occured a corresponding DataAccessException
See Also:   SessionFactoryUtils.convertTopLinkAccessException
See Also:   LocalSessionFactoryBean.setJdbcExceptionTranslator




destroy
public void destroy()(Code)



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



getObject
public Object getObject()(Code)



getObjectType
public Class getObjectType()(Code)



isSingleton
public boolean isSingleton()(Code)



setBeanClassLoader
public void setBeanClassLoader(ClassLoader classLoader)(Code)
Sets the given bean ClassLoader as TopLink Session ClassLoader.
See Also:   LocalSessionFactoryBean.setSessionClassLoader



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

Applied to any SQLException root cause of a TopLink DatabaseException, within Spring's PersistenceExceptionTranslator mechanism. The default is to rely on TopLink's native exception translation.
See Also:   oracle.toplink.exceptions.DatabaseException
See Also:   org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator
See Also:   org.springframework.jdbc.support.SQLStateSQLExceptionTranslator




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




Fields inherited from org.springframework.orm.toplink.LocalSessionFactory
final public static String DEFAULT_SESSIONS_XML(Code)(Java Doc)
final public static String DEFAULT_SESSION_NAME(Code)(Java Doc)
final protected Log logger(Code)(Java Doc)

Methods inherited from org.springframework.orm.toplink.LocalSessionFactory
public SessionFactory createSessionFactory() throws TopLinkException(Code)(Java Doc)
public Map getLoginPropertyMap()(Code)(Java Doc)
protected SessionManager getSessionManager()(Code)(Java Doc)
protected DatabaseSession loadDatabaseSession(String configLocation, String sessionName, ClassLoader sessionClassLoader) throws TopLinkException(Code)(Java Doc)
protected SessionFactory newSessionFactory(DatabaseSession session)(Code)(Java Doc)
public void setConfigLocation(String configLocation)(Code)(Java Doc)
public void setDataSource(DataSource dataSource)(Code)(Java Doc)
public void setDatabaseLogin(DatabaseLogin databaseLogin)(Code)(Java Doc)
protected void setDatabaseLogin(DatabaseSession session, DatabaseLogin login)(Code)(Java Doc)
public void setDatabasePlatform(DatabasePlatform databasePlatform)(Code)(Java Doc)
public void setLoginProperties(Properties loginProperties)(Code)(Java Doc)
public void setLoginPropertyMap(Map loginProperties)(Code)(Java Doc)
public void setSessionClassLoader(ClassLoader sessionClassLoader)(Code)(Java Doc)
public void setSessionLog(SessionLog sessionLog)(Code)(Java Doc)
public void setSessionName(String sessionName)(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.