Re: help with eogenerator
Re: help with eogenerator
- Subject: Re: help with eogenerator
- From: "Simon J. Oliver" <email@hidden>
- Date: Mon, 28 Jan 2008 08:43:23 -0600
OK, so no thinking *too* straight yet...
What I meant to say was that the second method uses
'entity.classNameWithoutPackage' instead of 'entity.name'.
And thinking about it some more, it may not specifically be related to
initial caps per se (except to the extent that capitalization is how
those two variables are most likely to differ). But I think maybe
there was somewhere else in the template where it made some
assumptions about capitalization that you could break by not naming
things right - but I don't recall the specifics of that right now.
On Jan 28, 2008, at 8:26 AM, Simon J Oliver (sjoliver) wrote:
OK, now I am thinking straight again - these were the template lines
that seemed to cause this problem:
public static ${entity.classNameWithoutPackage} fetchRequired$
{entity.name}(EOEditingContext editingContext, String keyName, Object
value) {
return ${entity.prefixClassNameWithoutPackage}.fetchRequired$
{entity.name}(editingContext, new EOKeyValueQualifier(keyName,
EOQualifier.QualifierOperatorEqual, value));
}
public static ${entity.classNameWithoutPackage} fetchRequired$
{entity.classNameWithoutPackage}(EOEditingContext editingContext,
EOQualifier qualifier) {
${entity.classNameWithoutPackage} eoObject = $
{entity.prefixClassNameWithoutPackage}.fetch$
{entity.classNameWithoutPackage}(editingContext, qualifier);
if (eoObject == null) {
throw new NoSuchElementException("There was no ${entity.name}
that matched the qualifier '" + qualifier + "'.");
}
return eoObject;
}
This is from a set of Mikes templates I downloaded a few weeks ago and
have been tweaking as needed since. So I don't know if this problem
persists - but Ted's experience suggests it might.
Notice that the first method intends to invoke the second, but one
gets the method name from 'entity.name', and the other from
'entity.prefixClassNameWithoutPackage'. It looks like they don't
evaluate to the same thing if the entity name is not initial caps.
Given that the second method then invokes the 'fetch...' function,
which is also defined using 'entity.name', it looks like the best
(correct?) fix is to use entity.name in the second method as well.
Simon
On Jan 28, 2008, at 8:09 AM, Theodore Petrosky wrote:
It does indeed appear to be a problem with the
initial cap.... This wasn't a problem before. I am
using postgresql as my backend and it will fold name
(table and column) to lower case if they are not
quoted.
Which leads me to think I should just use the Initial
cap in the table name and not worry about it. (It will
fold to lowercase when the table is created and during
a query) Until one day when someone fixes this and the
table names are quoted in a query and then I am hosed.
Ted
--- "Simon J. Oliver" <email@hidden> wrote:
Ted -
I've wrestled with this a couple of times, and
although I don't have
the code in front of me right now, I think it boiled
down to the fact
that the template uses different ways to arrive at
the method names
used in the first and second methods, and in
particular that these
behave differently with regard to case sensitivity -
resulting in
'fetchRequiredNewEntity' and
'fetchRequirednewentity' respectively.
I think this can be worked around by making sure
that your class names
(and entity names?) match in terms of
capitalization, and maybe also
that the relationship name matches as well.
Specifically, it looks like your newentity is not
initial caps, and I
think initial caps may be required per the
assumptions that the
standard template uses. Given that, it seems that
the 'wrong' version
of the method name and call to the overloaded method
is in the first
of the two methods - the one that has 'NewEntity'
with initial caps.
Therefore, you may want to look at the templates you
are using, and
make the code used to arrive at the first method
name (and the call to
the second one) look more like the way the second
one is generated.
Sorry if this is a bit vague. It's early, I'm low on
coffee for the
day, and I don't have any code in front of me (which
is why I'm not
posting this back to the list :-) ). But I know I
banged my head
against the wall long enough with this that I at
least wanted to offer
some pointers.
Regards,
Simon
On Jan 28, 2008, at 12:01 AM, Theodore Petrosky
wrote:
I did have things working...... I don't know what
I
updated (maybe the project wonder frameworks???)
but
now when I eogenerate I get errors...
public static newentity
fetchRequiredNewEntity(EOEditingContext
editingContext, String keyName, Object value) {
return
_newentity.fetchRequiredNewEntity(editingContext,
new
EOKeyValueQualifier(keyName,
EOQualifier.QualifierOperatorEqual, value));
}
public static newentity
fetchRequirednewentity(EOEditingContext
editingContext, EOQualifier qualifier) {
newentity eoObject =
_newentity.fetchnewentity(editingContext,
qualifier);
if (eoObject == null) {
throw new NoSuchElementException("There was
no
NewEntity that matched the qualifier '" +
qualifier +
"'.");
}
return eoObject;
}
I have red x's for the fetchnewentity and
fetchRequiredNewEntity. I did not have these last
week. I wish I understood what was happening here
better... this is frustrating.
can someone shed light here. I am using postgresql
as
my backend...
Ted
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search.
http://tools.search.yahoo.com/newsearch/category.php?
category=shopping
_______________________________________________
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
--
Simon J. Oliver
Applied Information Technology Center/SBBER
University of Memphis, TN
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
_______________________________________________
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
_______________________________________________
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