Java Doc for Interceptor.java in  » Database-ORM » hibernate » org » hibernate » 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 » Database ORM » hibernate » org.hibernate 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.hibernate.Interceptor

All known Subclasses:   org.hibernate.EmptyInterceptor,
Interceptor
public interface Interceptor (Code)
Allows user code to inspect and/or change property values.

Inspection occurs before property values are written and after they are read from the database.

There might be a single instance of Interceptor for a SessionFactory, or a new instance might be specified for each Session. Whichever approach is used, the interceptor must be serializable if the Session is to be serializable. This means that SessionFactory-scoped interceptors should implement readResolve().

The Session may not be invoked from a callback (nor may a callback cause a collection or proxy to be lazily initialized).

Instead of implementing this interface directly, it is usually better to extend EmptyInterceptor and override only the callback methods of interest.
See Also:   SessionFactory.openSession(Interceptor)
See Also:   org.hibernate.cfg.Configuration.setInterceptor(Interceptor)
See Also:   EmptyInterceptor
author:
   Gavin King




Method Summary
public  voidafterTransactionBegin(Transaction tx)
     Called when a Hibernate transaction is begun via the Hibernate Transaction API.
public  voidafterTransactionCompletion(Transaction tx)
     Called after a transaction is committed or rolled back.
public  voidbeforeTransactionCompletion(Transaction tx)
     Called before a transaction is committed (but not before rollback).
public  int[]findDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types)
     Called from flush().
public  ObjectgetEntity(String entityName, Serializable id)
    
public  StringgetEntityName(Object object)
    
public  Objectinstantiate(String entityName, EntityMode entityMode, Serializable id)
     Instantiate the entity class.
public  BooleanisTransient(Object entity)
     Called to distinguish between transient and detached entities.
public  voidonCollectionRecreate(Object collection, Serializable key)
     Called before a collection is (re)created.
public  voidonCollectionRemove(Object collection, Serializable key)
     Called before a collection is deleted.
public  voidonCollectionUpdate(Object collection, Serializable key)
     Called before a collection is updated.
public  voidonDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types)
     Called before an object is deleted.
public  booleanonFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types)
     Called when an object is detected to be dirty, during a flush.
public  booleanonLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types)
     Called just before an object is initialized.
public  StringonPrepareStatement(String sql)
     Called when sql string is being prepared.
public  booleanonSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types)
     Called before an object is saved.
public  voidpostFlush(Iterator entities)
     Called after a flush that actually ends in execution of the SQL statements required to synchronize in-memory state with the database.
public  voidpreFlush(Iterator entities)
    



Method Detail
afterTransactionBegin
public void afterTransactionBegin(Transaction tx)(Code)
Called when a Hibernate transaction is begun via the Hibernate Transaction API. Will not be called if transactions are being controlled via some other mechanism (CMT, for example).



afterTransactionCompletion
public void afterTransactionCompletion(Transaction tx)(Code)
Called after a transaction is committed or rolled back.



beforeTransactionCompletion
public void beforeTransactionCompletion(Transaction tx)(Code)
Called before a transaction is committed (but not before rollback).



findDirty
public int[] findDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types)(Code)
Called from flush(). The return value determines whether the entity is updated
  • an array of property indices - the entity is dirty
  • an empty array - the entity is not dirty
  • null - use Hibernate's default dirty-checking algorithm

Parameters:
  entity - a persistent entity array of dirty property indices or null to choose default behaviour



getEntity
public Object getEntity(String entityName, Serializable id) throws CallbackException(Code)
Get a fully loaded entity instance that is cached externally
Parameters:
  entityName - the name of the entity
Parameters:
  id - the instance identifier a fully initialized entity
throws:
  CallbackException -



getEntityName
public String getEntityName(Object object) throws CallbackException(Code)
Get the entity name for a persistent or transient instance
Parameters:
  object - an entity instance the name of the entity



instantiate
public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException(Code)
Instantiate the entity class. Return null to indicate that Hibernate should use the default constructor of the class. The identifier property of the returned instance should be initialized with the given identifier.
Parameters:
  entityName - the name of the entity
Parameters:
  entityMode - The type of entity instance to be returned.
Parameters:
  id - the identifier of the new instance an instance of the class, or null to choose default behaviour



isTransient
public Boolean isTransient(Object entity)(Code)
Called to distinguish between transient and detached entities. The return value determines the state of the entity with respect to the current session.
  • Boolean.TRUE - the entity is transient
  • Boolean.FALSE - the entity is detached
  • null - Hibernate uses the unsaved-value mapping and other heuristics to determine if the object is unsaved

Parameters:
  entity - a transient or detached entity Boolean or null to choose default behaviour



onCollectionRecreate
public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException(Code)
Called before a collection is (re)created.



onCollectionRemove
public void onCollectionRemove(Object collection, Serializable key) throws CallbackException(Code)
Called before a collection is deleted.



onCollectionUpdate
public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException(Code)
Called before a collection is updated.



onDelete
public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException(Code)
Called before an object is deleted. It is not recommended that the interceptor modify the state.



onFlushDirty
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException(Code)
Called when an object is detected to be dirty, during a flush. The interceptor may modify the detected currentState, which will be propagated to both the database and the persistent object. Note that not all flushes end in actual synchronization with the database, in which case the new currentState will be propagated to the object, but not necessarily (immediately) to the database. It is strongly recommended that the interceptor not modify the previousState. true if the user modified the currentState in any way.



onLoad
public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException(Code)
Called just before an object is initialized. The interceptor may change the state, which will be propagated to the persistent object. Note that when this method is called, entity will be an empty uninitialized instance of the class. true if the user modified the state in any way.



onPrepareStatement
public String onPrepareStatement(String sql)(Code)
Called when sql string is being prepared.
Parameters:
  sql - sql to be prepared original or modified sql



onSave
public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException(Code)
Called before an object is saved. The interceptor may modify the state, which will be used for the SQL INSERT and propagated to the persistent object. true if the user modified the state in any way.



postFlush
public void postFlush(Iterator entities) throws CallbackException(Code)
Called after a flush that actually ends in execution of the SQL statements required to synchronize in-memory state with the database.



preFlush
public void preFlush(Iterator entities) throws CallbackException(Code)
Called before a flush



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