Re: Problems with Stale Data
Re: Problems with Stale Data
- Subject: Re: Problems with Stale Data
- From: "Simon J. Oliver" <email@hidden>
- Date: Wed, 6 Feb 2008 13:01:01 -0600
I have been seeing this problem recently working with EO's stored in
MySQL as well. If I create an object and save it out to the database
(and in my case, we allow EOF to generate the primary key as it sees
fit) and then manipulate it and re-save it immediately, I get an
error similar to that described below - evidently because of some type
mismatch. If I refetch the object later, I can edit and resave without
issue, as the key types are consistent.
These entities had their PK fields stored as INTEGERs in the db, and
in EOF had a datatype of 'Long - Long l' - which is how EntityModeler
reverse-engineered them. Looks like the EOs were getting created with
an 'Integer' primary key field initially, as setting the Datatype to
'i' seemed to fix the problem.
So could this same problem that Mike fixed with the FB plugin also be
affecting the MySQL interface as well?
Simon
On Feb 6, 2008, at 12:19 PM, Chuck Hill wrote:
On Feb 5, 2008, at 5:15 PM, Chris Hoyt wrote:
I just wanted to follow this up. Changing the objects in my
classes from Number to Integer FIXED this problem. Using Number
has never caused me problems before, but I think that is because I
declared primary-keys as "long" in other DBs, but this one had them
declared as "int". Thanks for your help.
Mike Schrag recently fixed a problem in the FB plugin that made it
generate primary key values that did not match the type defined on
the PK attribute. That caused this same problem when we manually
assigned the PK before saving (please don't ask why this is done).
If you were doing something like that, you might want to report this
to OB as a bug.
Chuck
On Jan 29, 2008 9:22 PM, Chuck Hill <email@hidden> wrote:
On Jan 29, 2008, at 6:17 PM, Chris Hoyt wrote:
I checked the value type as well. I did update the plugin.
The problem only occurs when referencing recent records (15 minutes
or less) then goes away. That is why I thought it might be a data
refresh issue.
That sounds more like the PK is getting created with a different Java
class than what it is fetched with. When they expire out of snapshot
cache, consistent data is fetched.
This might be a bug in the OB plugin. What Java class are your
keys? Number is the wrong answer. :-) They will be Integer, Long,
BigDecimal, NSData or something concrete. What value type are you
using? Check the class after creation and then again after the
problem goes away.
Chuck
On Jan 29, 2008 2:19 PM, Chuck Hill <email@hidden>
wrote:
On Jan 28, 2008, at 10:14 PM, Chris Hoyt wrote:
java.lang.IllegalStateException: cannot update primary-key
'assignmentID' form '52067' to '52067' on object
What you can't see there is that one of those 52067 is an Integer
and
one is a Long (or a BigDecimal or some class other than what the
first one is.
I had recently upgraded by database so this looked like a real
possibility to me. Alas, the schema and EOModel both have "int".
I am using Webobjects 5.4 on OS X 10.5.1 with Open Base 10
The value type (I, L, D etc) not the external type (int) is the
potential problem. It could also be a WO 5.4 and / or OpenBase
plugin problem. Did you update the OB plugin?
Chuck
--
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
_______________________________________________
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