<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Some Guy wrote:
<blockquote
 cite="mid:B4BDFF69-FD97-4CFE-A96D-385068DBFF7B@heroicefforts.net"
 type="cite">
  <div>All that should be required is to define a version or timestamp
property for the entity in question.  Hbn will constrain against that
field when it performs the update.  If the db returns 0 updated rows,
then Hbn will throw the stale exception.  <br>
  </div>
</blockquote>
That's what I thought and did, but wasn't that simple. I think it's
because our persistence approach isn't too friendly with EJB.<br>
<blockquote
 cite="mid:B4BDFF69-FD97-4CFE-A96D-385068DBFF7B@heroicefforts.net"
 type="cite">
  <div><br>
  </div>
  <div>I recall there's a way to pessimistically lock using db locks
(select for update, etc.), but I assume that's only valid for the
duration of your transaction.  I never had call to use it.</div>
  <div><br>
  </div>
  <div>If you use timestamps, make sure your db columns have
millisecond resolution.</div>
  <div><br>
On Nov 12, 2009, at 10:18 PM, Mark Proctor &lt;<a moz-do-not-send="true"
 href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>&gt;
wrote:<br>
  <br>
  </div>
  <blockquote type="cite">
    <div>Michael Neale wrote:
    <blockquote
 cite="mid:50F08D8B-BF74-473E-98A5-FF24DB084FFA@gmail.com" type="cite">
      <pre wrap="">I am not aware of peasimistic locking use being very common. When  
people want it, it's generally cause the GUI suggests it (eg bob wants  
to view a file, but Alice has it locked)

  </pre>
    </blockquote>
With optimistic locking we can just submit our update and it fails if
something else updted the recorded in the mean time - doing a counter
comparison. With pessemistic we have to download the record first,
compare them, and then upload. As what we are comparing in a binary
blob, we want to avoid pulling that from the db.<br>
    <br>
Mark<br>
    <blockquote
 cite="mid:50F08D8B-BF74-473E-98A5-FF24DB084FFA@gmail.com" type="cite">
      <pre wrap="">Sent from my phone.

On 13/11/2009, at 10:27 AM, Salaboy <a moz-do-not-send="true"
 class="moz-txt-link-rfc2396E" href="mailto:salaboy@gmail.com">&lt;</a><a
 moz-do-not-send="true" href="mailto:salaboy@gmail.com">salaboy@gmail.com</a>&gt; wrote:

  </pre>
      <blockquote type="cite">
        <pre wrap="">I suppose that the versión field its being used. So, the default must
be optimistic

- Ing. Mauricio Salatino -

On Nov 12, 2009, at 9:43 PM, Michael Neale <a moz-do-not-send="true"
 class="moz-txt-link-rfc2396E" href="mailto:michael.neale@gmail.com">&lt;</a><a
 moz-do-not-send="true" href="mailto:michael.neale@gmail.com">michael.neale@gmail.com</a>&gt;
wrote:

    </pre>
        <blockquote type="cite">
          <pre wrap="">I thought optimistic locking was the default ? Or do you mean you  
know
how to switch, just that it doesn't work?


Sent from my phone.

On 13/11/2009, at 8:16 AM, Salaboy <a moz-do-not-send="true"
 class="moz-txt-link-rfc2396E" href="mailto:salaboy@gmail.com">&lt;</a><a
 moz-do-not-send="true" href="mailto:salaboy@gmail.com">salaboy@gmail.com</a>&gt; wrote:

      </pre>
          <blockquote type="cite">
            <pre wrap="">I Will take a look on that
Sent from my iPhone

On Nov 12, 2009, at 7:33 PM, Mark Proctor <a moz-do-not-send="true"
 class="moz-txt-link-rfc2396E" href="mailto:mproctor@codehaus.org">&lt;</a><a
 moz-do-not-send="true" href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>&gt;
wrote:

        </pre>
            <blockquote type="cite">
              <pre wrap="">Any hibernate guru's out there? Currently the persistence stuff  
uses
pessematic locking, which is slow, in theory we should be using
optimistic locking, but I couldn't get it to work. Anyone want to
give
that a go?

Mark

_______________________________________________
rules-dev mailing list
<a moz-do-not-send="true" href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>
<a moz-do-not-send="true"
 href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
          </pre>
            </blockquote>
            <pre wrap="">_______________________________________________
rules-dev mailing list
<a moz-do-not-send="true" href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>
<a moz-do-not-send="true"
 href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
        </pre>
          </blockquote>
          <pre wrap="">_______________________________________________
rules-dev mailing list
<a moz-do-not-send="true" href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>
<a moz-do-not-send="true"
 href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
      </pre>
        </blockquote>
        <pre wrap="">_______________________________________________
rules-dev mailing list
<a moz-do-not-send="true" href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>
<a moz-do-not-send="true"
 href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
    </pre>
      </blockquote>
      <pre wrap=""><!---->_______________________________________________
rules-dev mailing list
<a moz-do-not-send="true" href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>
<a moz-do-not-send="true"
 href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
  </pre>
    </blockquote>
    <br>
    </div>
  </blockquote>
  <blockquote type="cite">
    <div><span>_______________________________________________</span><br>
    <span>rules-dev mailing list</span><br>
    <span><a moz-do-not-send="true"
 href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a></span><br>
    <span><a moz-do-not-send="true"
 href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a></span><br>
    </div>
  </blockquote>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
rules-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
  </pre>
</blockquote>
<br>
</body>
</html>