• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Big Decimal as optimistic lock attribute?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Big Decimal as optimistic lock attribute?


  • Subject: Re: Big Decimal as optimistic lock attribute?
  • From: Jon Nolan <email@hidden>
  • Date: Wed, 09 Dec 2009 10:01:52 -0700
  • Organization: Loch Garman

Kieran Kelleher wrote:
Am I dreaming in thinking that I saw a discussion at some time in the past that there is some flaw with using BigDecimals as reliable* optimistic locking attributes? ..... or was that just NSTimestamps and float/double type values? .....
Kieran,

I seem to remember some trouble with this in the past involving precision but, like you, I don't remember if it extended to BigDecimal. Doesn't seem like it should given what that class is all about.

I've given up on struggling with various locking attribute types and have gone with locking on primary key and an int/long called serialNumber. Then I have something like this in the eo class.

public void willInsert() {
super.willInsert();
setSerialNumber(0);
}
public void willUpdate() {
super.willUpdate();
setSerialNumber(serialNumber().intValue() + 1);
}


I have zero failures with this approach and perhaps just as importantly zero headaches. The only (slight) negative is a bit of DB bloat.

Jon


_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Big Decimal as optimistic lock attribute?
      • From: Kieran Kelleher <email@hidden>
    • Re: Big Decimal as optimistic lock attribute?
      • From: David Avendasora <email@hidden>
References: 
 >Big Decimal as optimistic lock attribute? (From: Kieran Kelleher <email@hidden>)

  • Prev by Date: Re: Big Decimal as optimistic lock attribute?
  • Next by Date: Re: Big Decimal as optimistic lock attribute?
  • Previous by thread: Re: Big Decimal as optimistic lock attribute?
  • Next by thread: Re: Big Decimal as optimistic lock attribute?
  • Index(es):
    • Date
    • Thread