• 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: Can't Update Primary Key in PostgreSQL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't Update Primary Key in PostgreSQL


  • Subject: Re: Can't Update Primary Key in PostgreSQL
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 15 Jun 2006 12:09:51 -0700

Nick,

I have exposed primary keys with Postgres and not had this exception. I don't think that is the (or the only) cause. Carefully check the definitions of this PK and all the FK relations to it to ensure they are identical (same internal type, same external type, same value type etc.) What is usually happening behind the scenes is that the values are .equals() but not ==, or with BigDecimal numbers that the scale does not match.

HTH

Chuck

On Jun 15, 2006, at 11:59 AM, Mac Dev wrote:

Hello,

It's me again. The guy who just recently moved the database from MSSQL 7 to PostgreSQL 8.1.

I am getting errors like this whenever I try to save changes in my defaultEditingContext:

java.lang.IllegalStateException: cannot update primary-key 'user_ID' from '11795' to '11795' on object:{values ...

This was not happening when I was using the old MSSQL. I searched the list archive and found this:

Hunter,

By any chance, would you have set the pk to be a class property, would you?

r.

On 21/04/2004, at 7:49, Hunter Hillegas wrote:

I have an issue with EOF that I can't figure out. I've seen some discussion of similar issues on the list but no solution...

WO 5.2.3/Java 1.4.2 Panther 10.3.3

Basically, EOF is trying to update my primary key but it hasn't changed.

1. Create entity.
2. Save entity.
3. Fetch entity.
4. Update entity.
5. Save entity.

Step 5 generates this exception:

java.lang.IllegalStateException: cannot update primary-key 'recNum' from '4' to '4' on object:{values = {recNum = 4; season = "Spring 2007"; summary = "sdfasdfasdf"; coverImageUri = "1300989293-5838.jpg"; issueDepartments = ("<IssueDepartment 9ce8f3 ...
_______________________________________________

I have the PK set as class property because it is used as key for some direct action pages. Is there anyway to not have the PK updated when saving?


Any help is greatly appreciated.  Thank you very much for reading.

Regards,

Nick Yang

--
Coming in late 2006 - an introduction to web applications using WebObjects and Xcode http://www.global-village.net/wointro


Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects




_______________________________________________ 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
References: 
 >Can't Update Primary Key in PostgreSQL (From: Mac Dev <email@hidden>)

  • Prev by Date: Re: Can't Update Primary Key in PostgreSQL
  • Next by Date: Re: How to include a Framework in a WebObjects Application
  • Previous by thread: Re: Can't Update Primary Key in PostgreSQL
  • Next by thread: Security in Application
  • Index(es):
    • Date
    • Thread