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


java.lang.Object
   org.springframework.orm.toplink.TopLinkAccessor
      org.springframework.orm.toplink.TopLinkTemplate

TopLinkTemplate
public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperations(Code)
Helper class that simplifies TopLink data access code, and converts TopLinkExceptions into unchecked DataAccessExceptions, following the org.springframework.dao exception hierarchy.

The central method is execute, supporting TopLink access code implementing the TopLinkCallback interface. It provides TopLink Session handling such that neither the TopLinkCallback implementation nor the calling code needs to explicitly care about retrieving/closing TopLink Sessions, or handling Session lifecycle exceptions. For typical single step actions, there are various convenience methods (read, readAll, merge, delete, etc).

Can be used within a service implementation via direct instantiation with a SessionFactory reference, or get prepared in an application context and given to services as bean reference. Note: The SessionFactory should always be configured as bean in the application context, in the first case given to the service directly, in the second case to the prepared template.

This class can be considered as direct alternative to working with the raw TopLink Session API (through SessionFactoryUtils.getSession()). The major advantage is its automatic conversion to DataAccessExceptions, the major disadvantage that no checked application exceptions can get thrown from within data access code. Corresponding checks and the actual throwing of such exceptions can often be deferred to after callback execution, though.

LocalSessionFactoryBean is the preferred way of obtaining a reference to a specific TopLink SessionFactory. It will usually be configured to create ClientSessions for a ServerSession held by it, allowing for seamless multi-threaded execution. The Spring application context will manage its lifecycle, initializing and shutting down the factory as part of the application.

Thanks to Slavik Markovich for implementing the initial TopLink support prototype!
author:
   Juergen Hoeller
author:
   James Clark
since:
   1.2
See Also:   TopLinkTemplate.setSessionFactory
See Also:   TopLinkCallback
See Also:   oracle.toplink.sessions.Session
See Also:   TopLinkInterceptor
See Also:   LocalSessionFactoryBean
See Also:   TopLinkTransactionManager
See Also:   org.springframework.transaction.jta.JtaTransactionManager




Constructor Summary
public  TopLinkTemplate()
     Create a new TopLinkTemplate instance.
public  TopLinkTemplate(SessionFactory sessionFactory)
     Create a new TopLinkTemplate instance.
public  TopLinkTemplate(SessionFactory sessionFactory, boolean allowCreate)
     Create a new TopLinkTemplate instance.

Method Summary
public  Objectcopy(Object entity)
    
public  Objectcopy(Object entity, ObjectCopyingPolicy copyingPolicy)
    
public  ListcopyAll(Collection entities)
    
public  ListcopyAll(Collection entities, ObjectCopyingPolicy copyingPolicy)
    
public  ObjectdeepMerge(Object entity)
    
public  voiddelete(Object entity)
    
public  voiddeleteAll(Collection entities)
    
public  Objectexecute(TopLinkCallback action)
    
public  ListexecuteFind(TopLinkCallback action)
    
public  ObjectexecuteNamedQuery(Class entityClass, String queryName)
    
public  ObjectexecuteNamedQuery(Class entityClass, String queryName, boolean enforceReadOnly)
    
public  ObjectexecuteNamedQuery(Class entityClass, String queryName, Object[] args)
    
public  ObjectexecuteNamedQuery(Class entityClass, String queryName, Object[] args, boolean enforceReadOnly)
    
public  ObjectexecuteQuery(DatabaseQuery query)
    
public  ObjectexecuteQuery(DatabaseQuery query, boolean enforceReadOnly)
    
public  ObjectexecuteQuery(DatabaseQuery query, Object[] args)
    
public  ObjectexecuteQuery(DatabaseQuery query, Object[] args, boolean enforceReadOnly)
    
public  booleanisAllowCreate()
     Return if a new Session should be created if no thread-bound found.
public  Objectmerge(Object entity)
    
public  ObjectmergeWithReferences(Object entity)
    
public  Objectread(Class entityClass, Expression expression)
    
public  Objectread(Class entityClass, Expression expression, boolean enforceReadOnly)
    
public  Objectread(Class entityClass, Call call)
    
public  Objectread(Class entityClass, Call call, boolean enforceReadOnly)
    
public  ListreadAll(Class entityClass)
    
public  ListreadAll(Class entityClass, boolean enforceReadOnly)
    
public  ListreadAll(Class entityClass, Expression expression)
    
public  ListreadAll(Class entityClass, Expression expression, boolean enforceReadOnly)
    
public  ListreadAll(Class entityClass, Call call)
    
public  ListreadAll(Class entityClass, Call call, boolean enforceReadOnly)
    
public  ObjectreadAndCopy(Class entityClass, Object id)
    
public  ObjectreadAndCopy(Class entityClass, Object id, boolean enforceReadOnly)
    
public  ObjectreadAndCopy(Class entityClass, Object[] keys)
    
public  ObjectreadAndCopy(Class entityClass, Object[] keys, boolean enforceReadOnly)
    
public  ObjectreadById(Class entityClass, Object id)
    
public  ObjectreadById(Class entityClass, Object id, boolean enforceReadOnly)
    
public  ObjectreadById(Class entityClass, Object[] keys)
    
public  ObjectreadById(Class entityClass, Object[] keys, boolean enforceReadOnly)
    
public  Objectrefresh(Object entity)
    
public  Objectrefresh(Object entity, boolean enforceReadOnly)
    
public  ListrefreshAll(Collection entities)
    
public  ListrefreshAll(Collection entities, boolean enforceReadOnly)
    
public  Objectregister(Object entity)
    
public  ListregisterAll(Collection entities)
    
public  ObjectregisterExisting(Object entity)
    
public  voidregisterNew(Object entity)
    
public  voidsetAllowCreate(boolean allowCreate)
     Set if a new Session should be created when no transactional Session can be found for the current thread.
public  ObjectshallowMerge(Object entity)
    


Constructor Detail
TopLinkTemplate
public TopLinkTemplate()(Code)
Create a new TopLinkTemplate instance.



TopLinkTemplate
public TopLinkTemplate(SessionFactory sessionFactory)(Code)
Create a new TopLinkTemplate instance.



TopLinkTemplate
public TopLinkTemplate(SessionFactory sessionFactory, boolean allowCreate)(Code)
Create a new TopLinkTemplate instance.
Parameters:
  allowCreate - if a new Session should be created if no thread-bound found




Method Detail
copy
public Object copy(Object entity) throws DataAccessException(Code)



copy
public Object copy(Object entity, ObjectCopyingPolicy copyingPolicy) throws DataAccessException(Code)



copyAll
public List copyAll(Collection entities) throws DataAccessException(Code)



copyAll
public List copyAll(Collection entities, ObjectCopyingPolicy copyingPolicy) throws DataAccessException(Code)



deepMerge
public Object deepMerge(Object entity) throws DataAccessException(Code)



delete
public void delete(Object entity) throws DataAccessException(Code)



deleteAll
public void deleteAll(Collection entities) throws DataAccessException(Code)



execute
public Object execute(TopLinkCallback action) throws DataAccessException(Code)



executeFind
public List executeFind(TopLinkCallback action) throws DataAccessException(Code)



executeNamedQuery
public Object executeNamedQuery(Class entityClass, String queryName) throws DataAccessException(Code)



executeNamedQuery
public Object executeNamedQuery(Class entityClass, String queryName, boolean enforceReadOnly) throws DataAccessException(Code)



executeNamedQuery
public Object executeNamedQuery(Class entityClass, String queryName, Object[] args) throws DataAccessException(Code)



executeNamedQuery
public Object executeNamedQuery(Class entityClass, String queryName, Object[] args, boolean enforceReadOnly) throws DataAccessException(Code)



executeQuery
public Object executeQuery(DatabaseQuery query) throws DataAccessException(Code)



executeQuery
public Object executeQuery(DatabaseQuery query, boolean enforceReadOnly) throws DataAccessException(Code)



executeQuery
public Object executeQuery(DatabaseQuery query, Object[] args) throws DataAccessException(Code)



executeQuery
public Object executeQuery(DatabaseQuery query, Object[] args, boolean enforceReadOnly) throws DataAccessException(Code)



isAllowCreate
public boolean isAllowCreate()(Code)
Return if a new Session should be created if no thread-bound found.



merge
public Object merge(Object entity) throws DataAccessException(Code)



mergeWithReferences
public Object mergeWithReferences(Object entity) throws DataAccessException(Code)



read
public Object read(Class entityClass, Expression expression) throws DataAccessException(Code)



read
public Object read(Class entityClass, Expression expression, boolean enforceReadOnly) throws DataAccessException(Code)



read
public Object read(Class entityClass, Call call) throws DataAccessException(Code)



read
public Object read(Class entityClass, Call call, boolean enforceReadOnly) throws DataAccessException(Code)



readAll
public List readAll(Class entityClass) throws DataAccessException(Code)



readAll
public List readAll(Class entityClass, boolean enforceReadOnly) throws DataAccessException(Code)



readAll
public List readAll(Class entityClass, Expression expression) throws DataAccessException(Code)



readAll
public List readAll(Class entityClass, Expression expression, boolean enforceReadOnly) throws DataAccessException(Code)



readAll
public List readAll(Class entityClass, Call call) throws DataAccessException(Code)



readAll
public List readAll(Class entityClass, Call call, boolean enforceReadOnly) throws DataAccessException(Code)



readAndCopy
public Object readAndCopy(Class entityClass, Object id) throws DataAccessException(Code)



readAndCopy
public Object readAndCopy(Class entityClass, Object id, boolean enforceReadOnly) throws DataAccessException(Code)



readAndCopy
public Object readAndCopy(Class entityClass, Object[] keys) throws DataAccessException(Code)



readAndCopy
public Object readAndCopy(Class entityClass, Object[] keys, boolean enforceReadOnly) throws DataAccessException(Code)



readById
public Object readById(Class entityClass, Object id) throws DataAccessException(Code)



readById
public Object readById(Class entityClass, Object id, boolean enforceReadOnly) throws DataAccessException(Code)



readById
public Object readById(Class entityClass, Object[] keys) throws DataAccessException(Code)



readById
public Object readById(Class entityClass, Object[] keys, boolean enforceReadOnly) throws DataAccessException(Code)



refresh
public Object refresh(Object entity) throws DataAccessException(Code)



refresh
public Object refresh(Object entity, boolean enforceReadOnly) throws DataAccessException(Code)



refreshAll
public List refreshAll(Collection entities) throws DataAccessException(Code)



refreshAll
public List refreshAll(Collection entities, boolean enforceReadOnly) throws DataAccessException(Code)



register
public Object register(Object entity)(Code)



registerAll
public List registerAll(Collection entities)(Code)



registerExisting
public Object registerExisting(Object entity)(Code)



registerNew
public void registerNew(Object entity)(Code)



setAllowCreate
public void setAllowCreate(boolean allowCreate)(Code)
Set if a new Session should be created when no transactional Session can be found for the current thread.

TopLinkTemplate is aware of a corresponding Session bound to the current thread, for example when using TopLinkTransactionManager. If allowCreate is true, a new non-transactional Session will be created if none found, which needs to be closed at the end of the operation. If false, an IllegalStateException will get thrown in this case.
See Also:   SessionFactoryUtils.getSession(SessionFactoryboolean)




shallowMerge
public Object shallowMerge(Object entity) throws DataAccessException(Code)



Fields inherited from org.springframework.orm.toplink.TopLinkAccessor
final protected Log logger(Code)(Java Doc)

Methods inherited from org.springframework.orm.toplink.TopLinkAccessor
public void afterPropertiesSet()(Code)(Java Doc)
public DataAccessException convertTopLinkAccessException(TopLinkException ex)(Code)(Java Doc)
public SQLExceptionTranslator getJdbcExceptionTranslator()(Code)(Java Doc)
public SessionFactory getSessionFactory()(Code)(Java Doc)
public void setJdbcExceptionTranslator(SQLExceptionTranslator jdbcExceptionTranslator)(Code)(Java Doc)
public void setSessionFactory(SessionFactory sessionFactory)(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.