Steve,
I see the problem in the 4.1 source, but I haven't setup a test case for it:
org.hibernate.engine.loading.internal.CollectionLoadContext::endLoadingColle
ction(LoadingCollectionEntry,CollectionPersister) calls
CollectionEntry::postInitialize() *after* it calls
PersistentCollection.endRead().
postInitialize still takes the snapshot and
org.hibernate.collection.internal.AbstractPersistentCollection::endRead()
calls afterInitialize(), which in many collections still flushes queued
operations.
Therefore it seems like the problem would carry over to 4.1 -- the results
of queued operations including SimpleAdd's are carried into the
CollectionEntry's initial snapshot, which seems like a bug.
-John
-----Original Message-----
From: Steve Ebersole [mailto:steven.ebersole@gmail.com] On Behalf Of
Steve Ebersole
Sent: Tuesday, January 22, 2013 7:02 AM
To: John Walker
Cc: hibernate-dev(a)lists.jboss.org
Subject: Re: [hibernate-dev] Should CollectionEntry::snapshot Include
The Results Of Queued Operations?
To be honest, I am not sure there is a well defined expectation here.
I would say that the logical answer in my opinion would seem to be that
that snapshot should not contain queued things until after the flush
that processes them. But that's just my "gut feel".
Sorry I cannot be more definitive.
By the way, you mention 3.6. Have you tried with 4.0 or 4.1 to see the
outcome there?
On 01/21/2013 03:38 PM, John Walker wrote:
> In hibernate 3.6.10, CollectionEntry::snapshot is sometimes
> initialized after queued operations (SimpleAdd, Clear,etc) are
> processed. As a result, the snapshot can contain transient entities,
> and does not accurately reflect the state of the collection in the
database.
>
> Is this intentional, or should the CollectionEntry::snapshot be taken
> *after* all queued operations have been performed?
>
> For an example of what I'm talking about, see
> org.hibernate.engine.loading.CollectionLoadContext::endLoadingCollecti
> on(Loa dingCollectionEntry, CollectionPersister).
>
> This method calls endRead(), which for some collections (like
PersistentBag)
> applies queued operations. Then it calls
> CollectionEntry::postInitialize(), which takes the initial snapshot
> of the collection.
>
> Sorry to keep bugging you guys about this. (I posted a similar
> question about the same problem.) I've been having trouble finding
> good sources of information about Hibernate archecture/how things are
"supposed" to work.
>
> Thanks!
>
> -John
>
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/hibernate-dev