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


org.hibernate.collection.PersistentCollection

All known Subclasses:   org.hibernate.collection.AbstractPersistentCollection,
PersistentCollection
public interface PersistentCollection (Code)
Persistent collections are treated as value objects by Hibernate. ie. they have no independent existence beyond the object holding a reference to them. Unlike instances of entity classes, they are automatically deleted when unreferenced and automatically become persistent when held by a persistent object. Collections can be passed between different objects (change "roles") and this might cause their elements to move from one database table to another.

Hibernate "wraps" a java collection in an instance of PersistentCollection. This mechanism is designed to support tracking of changes to the collection's persistent state and lazy instantiation of collection elements. The downside is that only certain abstract collection types are supported and any extra semantics are lost

Applications should never use classes in this package directly, unless extending the "framework" here.

Changes to structure of the collection are recorded by the collection calling back to the session. Changes to mutable elements (ie. composite elements) are discovered by cloning their state when the collection is initialized and comparing at flush time.
author:
   Gavin King




Method Summary
public  booleanafterInitialize()
    
public  voidafterRowInsert(CollectionPersister persister, Object entry, int i)
    
public  voidbeforeInitialize(CollectionPersister persister, int anticipatedSize)
     Called before any elements are read into the collection, allowing appropriate initializations to occur.
public  voidbeginRead()
    
public  voidclearDirty()
     Clear the dirty flag, after flushing changes to the database.
public  voiddirty()
    
public  Serializabledisassemble(CollectionPersister persister)
    
public  booleanempty()
    
public  booleanendRead()
    
public  Iteratorentries(CollectionPersister persister)
    
public  booleanentryExists(Object entry, int i)
    
public  booleanequalsSnapshot(CollectionPersister persister)
    
public  voidforceInitialization()
     To be called internally by the session, forcing immediate initialization.
public  IteratorgetDeletes(CollectionPersister persister, boolean indexIsFormula)
    
public  ObjectgetElement(Object entry)
    
public  ObjectgetIdentifier(Object entry, int i)
    
public  ObjectgetIndex(Object entry, int i, CollectionPersister persister)
    
public  SerializablegetKey()
    
public  CollectiongetOrphans(Serializable snapshot, String entityName)
    
public  ObjectgetOwner()
     Get the owning entity.
public  CollectiongetQueuedOrphans(String entityName)
    
public  StringgetRole()
    
public  SerializablegetSnapshot(CollectionPersister persister)
    
public  ObjectgetSnapshotElement(Object entry, int i)
    
public  SerializablegetStoredSnapshot()
    
public  ObjectgetValue()
    
public  booleanhasQueuedOperations()
    
public  voidinitializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner)
    
public  booleanisDirectlyAccessible()
    
public  booleanisDirty()
     Is the collection dirty? Note that this is only reliable during the flush cycle, after the collection elements are dirty checked against the snapshot.
public  booleanisRowUpdatePossible()
    
public  booleanisSnapshotEmpty(Serializable snapshot)
    
public  booleanisUnreferenced()
    
public  booleanisWrapper(Object collection)
    
public  booleanneedsInserting(Object entry, int i, Type elemType)
    
public  booleanneedsRecreate(CollectionPersister persister)
    
public  booleanneedsUpdating(Object entry, int i, Type elemType)
    
public  voidpostAction()
     After flushing, clear any "queued" additions, since the database state is now synchronized with the memory state.
public  voidpreInsert(CollectionPersister persister)
    
public  IteratorqueuedAdditionIterator()
    
public  ObjectreadFrom(ResultSet rs, CollectionPersister role, CollectionAliases descriptor, Object owner)
    
public  booleansetCurrentSession(SessionImplementor session)
     Associate the collection with the given session.
public  voidsetOwner(Object entity)
    
public  voidsetSnapshot(Serializable key, String role, Serializable snapshot)
     After flushing, re-init snapshot state.
public  booleanunsetSession(SessionImplementor currentSession)
     Disassociate this collection from the given session.
public  booleanwasInitialized()
    



Method Detail
afterInitialize
public boolean afterInitialize()(Code)
Called after initializing from cache



afterRowInsert
public void afterRowInsert(CollectionPersister persister, Object entry, int i) throws HibernateException(Code)
Called after inserting a row, to fetch the natively generated id



beforeInitialize
public void beforeInitialize(CollectionPersister persister, int anticipatedSize)(Code)
Called before any elements are read into the collection, allowing appropriate initializations to occur.
Parameters:
  persister - The underlying collection persister.
Parameters:
  anticipatedSize - The anticipated size of the collection after initilization is complete.



beginRead
public void beginRead()(Code)
Called just before reading any rows from the JDBC result set



clearDirty
public void clearDirty()(Code)
Clear the dirty flag, after flushing changes to the database.



dirty
public void dirty()(Code)
Mark the collection as dirty



disassemble
public Serializable disassemble(CollectionPersister persister) throws HibernateException(Code)
Disassemble the collection, ready for the cache



empty
public boolean empty()(Code)
Is the collection empty? (don't try to initialize the collection)



endRead
public boolean endRead()(Code)
Called after reading all rows from the JDBC result set



entries
public Iterator entries(CollectionPersister persister)(Code)
Iterate all collection entries, during update of the database



entryExists
public boolean entryExists(Object entry, int i)(Code)
Does an element exist at this entry in the collection?



equalsSnapshot
public boolean equalsSnapshot(CollectionPersister persister) throws HibernateException(Code)
Does the current state exactly match the snapshot?



forceInitialization
public void forceInitialization() throws HibernateException(Code)
To be called internally by the session, forcing immediate initialization.



getDeletes
public Iterator getDeletes(CollectionPersister persister, boolean indexIsFormula) throws HibernateException(Code)
Get all the elements that need deleting



getElement
public Object getElement(Object entry)(Code)
Get the value of the given collection entry



getIdentifier
public Object getIdentifier(Object entry, int i)(Code)
Get the index of the given collection entry



getIndex
public Object getIndex(Object entry, int i, CollectionPersister persister)(Code)
Get the index of the given collection entry
Parameters:
  persister - it was more elegant before we added this...



getKey
public Serializable getKey()(Code)
Get the current collection key value



getOrphans
public Collection getOrphans(Serializable snapshot, String entityName) throws HibernateException(Code)
get all "orphaned" elements



getOwner
public Object getOwner()(Code)
Get the owning entity. Note that the owner is only set during the flush cycle, and when a new collection wrapper is created while loading an entity.



getQueuedOrphans
public Collection getQueuedOrphans(String entityName)(Code)
Get the "queued" orphans



getRole
public String getRole()(Code)
Get the current role name



getSnapshot
public Serializable getSnapshot(CollectionPersister persister) throws HibernateException(Code)
Return a new snapshot of the current state of the collection



getSnapshotElement
public Object getSnapshotElement(Object entry, int i)(Code)
Get the snapshot value of the given collection entry



getStoredSnapshot
public Serializable getStoredSnapshot()(Code)
Get the snapshot cached by the collection instance



getValue
public Object getValue()(Code)
return the user-visible collection (or array) instance



hasQueuedOperations
public boolean hasQueuedOperations()(Code)
Does this instance have any "queued" additions?



initializeFromCache
public void initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner) throws HibernateException(Code)
Read the state of the collection from a disassembled cached value



isDirectlyAccessible
public boolean isDirectlyAccessible()(Code)
Could the application possibly have a direct reference to the underlying collection implementation?



isDirty
public boolean isDirty()(Code)
Is the collection dirty? Note that this is only reliable during the flush cycle, after the collection elements are dirty checked against the snapshot.



isRowUpdatePossible
public boolean isRowUpdatePossible()(Code)



isSnapshotEmpty
public boolean isSnapshotEmpty(Serializable snapshot)(Code)
Is the snapshot empty?



isUnreferenced
public boolean isUnreferenced()(Code)
Is the collection unreferenced?



isWrapper
public boolean isWrapper(Object collection)(Code)
Is this the wrapper for the given underlying collection instance?



needsInserting
public boolean needsInserting(Object entry, int i, Type elemType) throws HibernateException(Code)
Do we need to insert this element?



needsRecreate
public boolean needsRecreate(CollectionPersister persister)(Code)
Do we need to completely recreate this collection when it changes?



needsUpdating
public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException(Code)
Do we need to update this element?



postAction
public void postAction()(Code)
After flushing, clear any "queued" additions, since the database state is now synchronized with the memory state.



preInsert
public void preInsert(CollectionPersister persister) throws HibernateException(Code)
Called before inserting rows, to ensure that any surrogate keys are fully generated



queuedAdditionIterator
public Iterator queuedAdditionIterator()(Code)
Iterate the "queued" additions



readFrom
public Object readFrom(ResultSet rs, CollectionPersister role, CollectionAliases descriptor, Object owner) throws HibernateException, SQLException(Code)
Read a row from the JDBC result set



setCurrentSession
public boolean setCurrentSession(SessionImplementor session) throws HibernateException(Code)
Associate the collection with the given session. false if the collection was already associated with the session
throws:
  HibernateException - if the collection was already associatedwith another open session



setOwner
public void setOwner(Object entity)(Code)
Set the reference to the owning entity



setSnapshot
public void setSnapshot(Serializable key, String role, Serializable snapshot)(Code)
After flushing, re-init snapshot state.



unsetSession
public boolean unsetSession(SessionImplementor currentSession)(Code)
Disassociate this collection from the given session. true if this was currently associated with the given session



wasInitialized
public boolean wasInitialized()(Code)
Is this instance initialized?



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