Hi,

<snip>


...

NSArray args = new NSArray(new Object[] {user, account});
return (AccountUser)EOUtilities.objectWithQualifierFormat(context, "AccountUser", "user = %@ and account = %@", args)

Ah, two lines.  That feels better!

And they actually work! :D Thanks! It was the stupid "usedID" instead of "user" problem... NEVER code before noon...

LOL!


About the "AccountUser", I try to avoid string to avoid typing errors and such. The class name should be the entity name... right?

Assuming that you are using packages, I'd would say that the class name (com.foo.bar.AccountUser) is _never_ the entity name. The key concept here is that one class can implement many entities. What I do is to use EOGenerator (from the DBEdit folks, also check out EOReporter) to generate the java files and add a line like this:

public static final String ENTITY_NAME = "AccountUser";

Then, to avoid typing errors:

return (AccountUser)EOUtilities.objectWithQualifierFormat(context, AccountUser.ENTITY_NAME, "user = %@ and account = %@", args)




  Nice code reduction, btw... :)

There is an old saying in EOF, "If you are writing code, you are doing it wrong." The truth is probably closer to "If you are writing more than two or three lines of code, you are doing it wrong."

Chuck


--
Coming in 2006 - an introduction to web applications using WebObjects and Xcode http://www.global-village.net/wointro

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 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