tdmartin102 / ajrdatabase

An OpenSource implementation of Apple's Objective-C Enterprise Objects framework
22 stars 9 forks source link

EOModeler functionality question / bug #11

Open sstillwell opened 6 years ago

sstillwell commented 6 years ago

When creating a new model and connecting to a MySQL database, I can authenticate to the database and get a list of tables, but after selecting tables to model and clicking "Finish" it just hangs. known issue?

For PostgreSQL it doesn't get that far. I can authenticate to the database but the wizard never proceeds to the list of tables.

Is this an instance of something that only works for Oracle because it received the most exercise over time? Is this something where a relative newcomer could be useful helping out (either on fleshing out adapter functionality or working on EOModeler)

tdmartin102 commented 6 years ago

Yes EOModeler is extremely buggy. That said, at least for your above example of clicking on finish after selecting Tables in MySQL, that has worked for me. I just tried it now and it worked. But I do remember in the past having it hang there, so I'm unsure. Most likely for PostgreSQL it is an issue about the Adaptor not being fully implemented. Debugging EOModeler is difficult. I got it to the point where it SORTA works, and left it be.

I have a few tips.

First, There is an extremely handy feature for debugging. If you are debugging in Xcode you can set an environment variable 'EOAdaptorDebugEnabled' and set the value to 'YES' This will log all executed SQL. That also works as a Defaults system setting.

Second, when working with EOModeler always make a backup of your model before doing anything. I have had EOModeler destroy the existing model. Also, when it saves a model the ordering of things are random, which makes commits messy. I usually restore all the unaffected table files so that I can restrict the commit to the affected table file. Um, also EOModeler can create code for you based upon the model. This kind of works although it may need more work. It may not work perfectly for all models, and that would be on me since I wrote that part.

The table ARJ_SEQUENCE_DATA is ONLY needed for MySQL. it is an artificial construct to allow me to create sequence numbers. The MySQL built in Auto Increment feature, just does not work for this framework. All other database models that I have worked with have a feature to deliver sequence numbers before writing rows.

For a to-one relationship, if there is a foreign key yet no corresponding object the framework will throw an exception. In the REAL world this is not so great. I think I have code in the example that shows how to deal with that.

Finally I want to point out that there is a HUGE departure from the existing documentation for EOF. All custom EO objects MUST be a subclass of EOEnterpriseObject. Standard EOF allows any object to work. I changed that to make my life easier.

Any work you could do on fleshing out the PostgreSQL adaptor would be wonderful. I am unfamiliar with Postgres so there would be a bit of learning there. I think it is actually pretty close. Alex wrote the original code and used it as an example. If you want to tackle EOModeler that would be awesome. You also have my sympathy. It is .... difficult.

One last note: This frameworks just does not fit the modern paradigm, the coding and the installation. It seems that the normal thing to do now is to embed the frameworks in the applications. This is an insane solution for us as we have many, MANY applications and to have each of them embed the same frameworks is .... just nuts ... So I never went there. Modernizing the code would not hurt. It would be a big effort. Also switching to ARC within the framework is NOT a good idea. There is some fancy footwork surrounding the Faulting of objects which would likely be impossible to implement under ARC. You could of course exclude certain objects from ARC, and it would work fine. Of course using ARC for apps using this framework is fine. I even used Swift once, and that worked fine as well. You have to understand to that I am getting rather long in the tooth and so am a bit slow on adapting to new trends.

Thats it, Im done with tips. I hope you find this useful. There IS a big learning curve and some rather nasty gotchas here and there, but... for me at least, this is an extremely useful framework.