On Sep 3, 2011, at 1:50 AM, Ray Kiddy wrote:

> 
> On Sep 2, 2011, at 12:35 AM, David Avendasora wrote:
> 
>> Hi all,
>> 
>> This is one for posterity. AKA: When I'm an idiot in the future.
>> 
>> I was having a problem with a WODisplayGroup that would have the right 
>> number of objects in the selectedObjects Array, but they were all instances 
>> of the same EO.
>> 
>> Easy, you say; there's something wrong with the item setter on the 
>> WORepetition. Not so fast. It the setter was fine. The SQL that was being 
>> used to fetch the data was right too.
>> 
>> The model was wrong. The PK in the FrontBase DB was a LONGINT, but the PK in 
>> the EOModel had an external type of INT. The value stored in the DB field 
>> was not too long for an INT and an ALTER TABLE statement changed it without 
>> issue. Apparently there something about the process in the JDBC driver or 
>> EOF that chokes on it turning a Long into an Integer, but not enough to 
>> throw an exception, but enough to make all the values the same, in a 
>> non-deterministic way. If I quit and relaunched the app, it would likely 
>> repeat a different instance, but not always.
>> 
>> Dave _______________________________________________
> 
> Was this in a Wonder app or a vanilla WO app?

Ray, have you forgotten Montreal already?! There's no such thing as a vanilla 
WO app anymore. ;-) It's a Wonder app.

> One thing that has occurred to me in the past is that there can be some model 
> validation on application launch. If this problem was logged out from the 
> app, would that have helped.

Well, it was model validation that got me into this mess in the first place! It 
choked on a FK that was an Integer that pointed to the PK being a Long. I 
figured that the easy way to fix it would be just to change the model since I 
knew that the actual values of the field would fit in an Integer just fine. I 
suppose if the there were a way to have EOF ask the DB directly what the 
datatypes of the each modeled attribute are, that would be great, but I'm 
guessing that every DB would have a different way of giving you that info, 
unless the JDBCInfo has it... don't know. Sounds like a nice solution that 
would have saved me several hours of head scratching though.

> I know one thing that always gets me in the fact that WOLips will reverse 
> engineer an INT in a MySQL database into a Long. Also, there are bad things 
> that people do in inheritance situations and bad things that people do while 
> setting up certain relationships and we could just say that this is going to 
> be bad.

There is some of that. I'm guessing making sure the DB Plugin is accurate would 
eliminate a lot of issues.

> A class that would wait for applicationDidLaunch and then check the loaded 
> models could go into ERExtensions. It could start small, people can add rules 
> for the databases they know, and it could just advise on problems and 
> otherwise stay out of the way. Unless this is already done somehow via a name 
> I am not recognizing. Anyone know?

I think just have the DBPlugIn do it. That already contains the glue between 
EOF and a datastore. Maybe even have an Interface that defines what the checks 
are so people have some way of seeing what things are left to be implemented 
for their DB's plugin.

Dave _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to