<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">entry.isChanged() returns true if the entry is, well, changed. &nbsp;Changed includes {created, modified, removed}<div><br></div><div>entry.isCreated() only returns true if the entry has just been created in the scope of the invocation.</div><div><br></div><div>See the Javadocs for details:</div><div><br></div><div><a href="http://docs.jboss.org/infinispan/4.1/apidocs/org/infinispan/container/entries/CacheEntry.html#isChanged">http://docs.jboss.org/infinispan/4.1/apidocs/org/infinispan/container/entries/CacheEntry.html#isChanged</a>()</div><div><a href="http://docs.jboss.org/infinispan/4.1/apidocs/org/infinispan/container/entries/CacheEntry.html#isCreated">http://docs.jboss.org/infinispan/4.1/apidocs/org/infinispan/container/entries/CacheEntry.html#isCreated</a>()</div><div><br></div><div>Cheers</div><div>Manik</div><div><br></div><div><div><div><div>On 22 Jul 2010, at 14:45, Israel Lacerra wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Navin,<br><br>I update my trunk and I still have a little issue. But, maybe, it's a problem in my code, cause I had to change the order of QueryInterceptor.&nbsp; This line: cache.getAdvancedCache().addInterceptorAfter(inter, LockingInterceptor.class); in QueryHelper did not work for me, because somehow the LockingInterceptor was not in the interceptor chain yet.<br>

<br>Anyway, putting the same key twice:<br><br>"Key, value pairing is: - test + org.infinispan.query.Pessoa@2af8f5<br>Entry is created<br>Entry is changed<br>Key, value pairing is: - test + org.infinispan.query.Pessoa@1088a1b<br>

Entry is changed"<br><br>entry.isChanged() is always returning true. But, like I said, maybe it's a problem with my changes. <br><br>I will see it more carefully tomorrow...<br><br><br>Israel<br><br><div class="gmail_quote">

On Thu, Jul 22, 2010 at 10:09 AM, Manik Surtani <span dir="ltr">&lt;<a href="mailto:manik@jboss.org">manik@jboss.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div class="im"><br>
On 21 Jul 2010, at 12:54, Navin Surtani wrote:<br>
<br>
</div><div class="im">&gt; 1 - User does a put()<br>
&gt; 2 - Interceptor checks the set of keys used within the same context to<br>
&gt; see if the same key has been used<br>
&gt; 3 - If it has an UPDATE is used.<br>
&gt; 4 - If not we do an ADD.<br>
<br>
</div>Sorry, just saw this. &nbsp;To confirm, this should work even beyond the scope of a single invocation, and even a single transaction, correct? &nbsp;E.g.,:<br>
<br>
Tx1:<br>
 &nbsp; &nbsp; &nbsp; &nbsp;1) creates a NEW entry using cache.put()<br>
 &nbsp; &nbsp; &nbsp; &nbsp;2) new entry is indexed<br>
<br>
Tx2 (potentially at a later date):<br>
 &nbsp; &nbsp; &nbsp; &nbsp;1) updates the entry using cache.put()<br>
 &nbsp; &nbsp; &nbsp; &nbsp;2) the index should be updated<br>
<br>
So to that end, just checking the presence of the entry in the invocation context is not good enough - all it will tell you is whether the entry was touched within the same scope (whether that scope is an invocation or a transaction is irrelevant).<br>


<br>
Mircea's solution of testing entry.isCreated() is a valid one.<br>
<br>
Cheers<br>
Manik<br>
<font color="#888888"><br>
--<br>
Manik Surtani<br>
<a href="mailto:manik@jboss.org">manik@jboss.org</a><br>
Lead, Infinispan<br>
Lead, JBoss Cache<br>
<a href="http://www.infinispan.org/" target="_blank">http://www.infinispan.org</a><br>
<a href="http://www.jbosscache.org/" target="_blank">http://www.jbosscache.org</a><br>
</font><div><div></div><div class="h5"><br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
infinispan-dev mailing list<br>
<a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
</div></div></blockquote></div><br>
_______________________________________________<br>infinispan-dev mailing list<br><a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/infinispan-dev</blockquote></div><br><div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 12px; "><div>--</div><div>Manik Surtani</div><div><a href="mailto:manik@jboss.org">manik@jboss.org</a></div><div>Lead, Infinispan</div><div>Lead, JBoss Cache</div><div><a href="http://www.infinispan.org">http://www.infinispan.org</a></div><div><a href="http://www.jbosscache.org">http://www.jbosscache.org</a></div><div><br></div></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br></div></div></body></html>