Re: A couple of issues I've faced
Re: A couple of issues I've faced
- Subject: Re: A couple of issues I've faced
- From: David Avendasora <email@hidden>
- Date: Sun, 27 Feb 2011 05:51:43 -0500
Hi John,
On Feb 26, 2011, at 12:10 PM, John Baldwin wrote:
> I'm not sure if I'm doing things incorrectly, but thought I'd share my experience to see if others can guide me.
>
> First, I reverse engineered from an existing database. It worked well, except the class name for the entities was com.webobjects.EOGenericRecord. That had me stumped for a bit, because it made sense if that meant "class to extend." Now that I know what the field is for in the Modeler.
If you don't have any custom logic in a given entity and all you want to do is get and set values in it, then you don't even need to generate your own class. That's why Entity Modeler defaults to EOGeneric record when you reverse engineer.
> And I've been struggling to get eogenerator to create my entity classes in the destination I want. I finally just created them in the "default" package and refactored them into my <base package>.eo package. At one point, it even created the Entity.java file in one package and the _Entity.java file in another package. So I'm not sure if I'm doing this right. But in the getting started video, the files were created in the default package and refactored.
Just add the package name to the Entity's class name in Entity Modeler (com.myCom.myApp.eo.MyEntity instead of just MyEntity) and when you generate, it will automatically create the packages you. You can specify a different package for the Superclass if you want in the .eogen file, but I normally don't.
>
> Finally, I made a binding to a property in my Main component called "aCustomer" and then had the code auto-generated by command-clicking. Unfortunately, it created a method called setaCustomer (instead of setACustomer) which threw a takeValueForKey exception.
Yeah, this is a very annoying bug in WOLips. I curse/grumble every time I run into it as well. I don't know what it is about the "a" in front of a binding that makes the code generator in WOLips choke.
The "work around" for it is to not have it create the getter and setter automatically, just the instance variable. Once WOLips has added the instance variable, go into the class, make the instance variable private. This will cause eclipse to warn you that it's not being used anywhere. You can then click on the warning icon or on the variable name itself and eclipse will give you potential ways to fix the warning, one of them will be to generate getters and setters. This will allow you to get the names right.
Dave _______________________________________________
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