Migrating from EOF to Cayenne
Migrating from EOF to Cayenne
- Subject: Migrating from EOF to Cayenne
- From: John Huss <email@hidden>
- Date: Wed, 11 Jul 2012 10:09:08 -0500
At WOWODC there was a lot of interest in migrating from EOF to Cayenne, and even entirely rebasing Wonder to run on top of Cayenne instead of EOF.
Why would anyone want to do this?
- Cayenne is open-source and is actively being developed
- Cayenne has great concurrency support which is in stark contrast to EOF single-threaded architecture
- Cayenne is conceptually very similar to EOF so the transition is fairly straightforward
For those reasons it is a much better long term solution than EOF, which is now frozen in time. Cayenne can be used inside a WO application as an EOF replacement while continuing to use the rest of WebObjects.
I'm interested. Now what?
- Learn about Cayenne. The best source of information for comparing EOF and Cayenne is on the wiki. In addition, you can look at the documentation for Cayenne.
- Use Cayenne in your new projects. Cayenne runs just fine inside a WebObjects application. Wonder has the ERCayenne framework and ERCayenneExample to help you get started. I suggest working with the trunk of the Cayenne source (and Wonder too) since some things are just being added to make this easier.
- Help work on easing and automating the migration from EOF to Cayenne. It is possible to automate a large part of the work involved in moving from EOF to Cayenne. But it requires effort. ERCayenne in Wonder has a class that will convert an EOModel to a Cayenne model (the class is CayenneConverter). This works well, but could be improved. I've started working on an Eclipse refactoring script that will convert from one API to the other. Yes, you may not have known (I didn't) that Eclipse can record a series of refactorings and save it as a script. The bulk of the migration work is creating refactoring scripts in Eclipse by performing refactorings on a stubbed out version of the EOF API to convert the API into the equivalent Cayenne API. After performing the refactorings, a script can be exported using Refactor->"Create Script". For EOF methods that do not have a direct Cayenne equivalent, helper methods (or classes) will need to be written that can serve as a direct replacement.
How can I help specifically with the migration effort?
- CayenneConverter in ERCayenne (for converting the model) does not convert the connection dictionaries in the EOModel yet.
- CayenneConverter does a poor job converting fetch specs defined in the model currently.
- We need to create new subclasses of Cayenne's DbAdapter that use the Wonder naming convention for primary key generators/sequences. This is done by subclassing classes like PostgresPkGenerator and overriding sequenceName. This is necessary to support existing databases created with EOF.
- An Wonder-like entity template is already in ERCayenneExample. This needs to be examined and any missing functions from WonderEntity need to be added. For example, I know some the .deleteAllXXXXRelationships and .createXXXX(…) methods are missing.
- More refactorings need to created. For example, a refactoring script should be made that changes NSArray and NSDictionary methods to the equivalent List or Map APIs (since Cayenne doesn't use these classes for relationships or fetch results you probably want to minimize the places you need them).
- Submit code to Cayenne or create Jira issues
Any questions? :-)
John
_______________________________________________
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