result-sets to specific contextual data
related to processing that result-sets.Implementation Note
internally an IdentityMap is used to maintain
the mappings; IdentityMap was chosen because I'd rather not be
dependent upon potentially bad ResultSet#equals and {ResultSet#hashCode}
implementations.
Considering the JDBC-redesign work, would further like this contextual info not mapped seperately, but available based on the result set being processed. This would also allow maintaining a single mapping as we could reliably get notification of the result-set closing...
| Modifier and Type | Field and Description |
|---|---|
| private Map | |
| private Map | |
| private static final Logger | |
| private final PersistenceContext | |
| private Map |
| Access | Constructor and Description |
|---|---|
| public | LoadContexts(PersistenceContext
The persistence context to which this
will be bound. persistenceContext)Creates and binds this to the given persistence context. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| pack-priv void | |
| public CollectionLoadContext | Returns: The processing context.The result set for which to retrieve the context. resultSet)Get the |
| public EntityLoadContext | |
| private EntityMode | |
| pack-priv Map | |
| public PersistenceContext | Returns: The persistence context to which this is bound.Retrieves the persistence context to which this is bound. |
| private SessionImplementor | |
| public boolean | Returns: True if we currently hold state pertaining to loading collections; false otherwise.Do we currently have any internal entries corresponding to loading collections? |
| public boolean | Returns: True if we currently hold state pertaining to a registered loading collections; false otherwise.Do we currently have any registered internal entries corresponding to loading collections? |
| public PersistentCollection | Returns: The loading collection, or null if not found.The collection persister persister, Serializable The owner key ownerKey)Attempt to locate the loading collection given the owner's key. |
| pack-priv LoadingCollectionEntry | Returns: The located entry; or null.The collection key. key)Locate the LoadingCollectionEntry within *any* of the tracked
|
| pack-priv void | registerLoadingCollectionXRef(CollectionKey
The xref collection key entryKey, LoadingCollectionEntry The corresponding loading collection entry entry)Register a loading collection xref. |
| pack-priv void | unregisterLoadingCollectionXRef(CollectionKey
The key of the collection we are done processing. key)The inverse of |
| collectionLoadContexts | back to summary |
|---|---|
| private Map<K, V> collectionLoadContexts | |
| entityLoadContexts | back to summary |
|---|---|
| private Map<K, V> entityLoadContexts | |
| log | back to summary |
|---|---|
| private static final Logger log | |
| persistenceContext | back to summary |
|---|---|
| private final PersistenceContext persistenceContext | |
| xrefLoadingCollectionEntries | back to summary |
|---|---|
| private Map<K, V> xrefLoadingCollectionEntries | |
| LoadContexts | back to summary |
|---|---|
| public LoadContexts(PersistenceContext persistenceContext) Creates and binds this to the given persistence context.
| |
| cleanup | back to summary |
|---|---|
| public void cleanup(ResultSet resultSet) Release internal state associated with the given result set. This should be called when we are done with processing said result set, ideally as the result set is being closed.
| |
| cleanup | back to summary |
|---|---|
| public void cleanup() Release internal state associated with *all* result sets. This is intended as a "failsafe" process to make sure we get everything cleaned up and released. | |
| cleanupCollectionXRefs | back to summary |
|---|---|
| pack-priv void cleanupCollectionXRefs(Set<E> entryKeys) | |
| getCollectionLoadContext | back to summary |
|---|---|
| public CollectionLoadContext getCollectionLoadContext(ResultSet resultSet) Get the
| |
| getEntityLoadContext | back to summary |
|---|---|
| public EntityLoadContext getEntityLoadContext(ResultSet resultSet) | |
| getEntityMode | back to summary |
|---|---|
| private EntityMode getEntityMode() | |
| getLoadingCollectionXRefs | back to summary |
|---|---|
| pack-priv Map | |
| getPersistenceContext | back to summary |
|---|---|
| public PersistenceContext getPersistenceContext() Retrieves the persistence context to which this is bound.
| |
| getSession | back to summary |
|---|---|
| private SessionImplementor getSession() | |
| hasLoadingCollectionEntries | back to summary |
|---|---|
| public boolean hasLoadingCollectionEntries() Do we currently have any internal entries corresponding to loading collections?
| |
| hasRegisteredLoadingCollectionEntries | back to summary |
|---|---|
| public boolean hasRegisteredLoadingCollectionEntries() Do we currently have any registered internal entries corresponding to loading collections?
| |
| locateLoadingCollection | back to summary |
|---|---|
| public PersistentCollection locateLoadingCollection(CollectionPersister persister, Serializable ownerKey) Attempt to locate the loading collection given the owner's key. The lookup here occurs against all result-set contexts...
| |
| locateLoadingCollectionEntry | back to summary |
|---|---|
| pack-priv LoadingCollectionEntry locateLoadingCollectionEntry(CollectionKey key) Locate the LoadingCollectionEntry within *any* of the tracked
Implementation Note package protected, as this is meant solely for use
by
| |
| registerLoadingCollectionXRef | back to summary |
|---|---|
| pack-priv void registerLoadingCollectionXRef(CollectionKey entryKey, LoadingCollectionEntry entry) Register a loading collection xref. This xref map is used because sometimes a collection is in process of being loaded from one result set, but needs to be accessed from the context of another "nested" result set processing. Implementation Note package protected, as this is meant solely for use
by
| |
| unregisterLoadingCollectionXRef | back to summary |
|---|---|
| pack-priv void unregisterLoadingCollectionXRef(CollectionKey key) The inverse of
The idea here is that other loading collections can now reference said
collection directly from the Implementation Note package protected, as this is meant solely for use
by
| |