Discussion:
AW: AW: [Middlegen-user] Final S gets chopped in CMR methods
Meyer-Willner, Bernhard
2002-08-09 05:59:02 UTC
Permalink
Seems like this table element in build.xml is the best solution for tricky
cases. It already seems hard to get the pluralisation logic work right in
English, but try German or other languages and you're really out of luck...


-----Ursprüngliche Nachricht-----
Von: ***@netcom.no [mailto:***@netcom.no]
Gesendet: Freitag, 9. August 2002 09:51
An: Meyer-Willner, Bernhard
Cc: middlegen-***@lists.sourceforge.net
Betreff: Re: AW: [Middlegen-user] Final S gets chopped in CMR methods




----- Original Message -----
From: "Meyer-Willner, Bernhard" <Meyer-***@logica.com>
Date: Friday, August 9, 2002 9:24 am
Subject: AW: [Middlegen-user] Final S gets chopped in CMR methods
Thanks a lot for your info. I already saw a feature request being
added. I
1) Which table element do you mean? Is it in the preferences xml file?
The optional ones directly under tha <middlegen> task. See the
samples/build.xml file. Better docs will be out soon. A week or so.
2) The 'Middlegen smartness' would work fine for me, but in my
case the two
accessors (setGla/getGla) which should have been (setGlas/getGlas)
point to
a single instance - the methods take rsp. return a GlasLocal - so
there was
no reason for Middlegen trying to pluralise. Rather it seems to me it
thought it was Plural (because of the final s) and therefore
chopped it off.
Exactly. That's what it thought. People tend to name their tables in
plural (customers, orders etc.) so the current logic assumes something
is already plural if it ends with an s. Actually, it's a bit smarter -
ss is considered singular (glass, mess etc.)

Considering your case: What plurality can we expect an English word
ending in "as" to have? Should we make a spessial case for it like ss?
Or put differently: Are there any English words in singular form that
end with "as"? I don't think so. Therefore we can assume as is plural.
Shoot me if I'm wrong.

Example: (lemmas, auras : plural) I have a sneaky feeling this is latin
and not English.

Cheers,
Aslak
Is my description correct and does the fixed Util class in CVS
solve this
issue?
Nein. It nur understands English.
Thanks,
Bernhard
-----Ursprüngliche Nachricht-----
Gesendet: Donnerstag, 8. August 2002 19:12
Betreff: RE: [Middlegen-user] Final S gets chopped in CMR methods
Hi Bernhard,
Middlegen tries to be smart and pluralise or singularise english
words,depending on the cardinality. This is done in
middlegen.Util.singularise()and middlegen.Util.pluralise(). This
code is not optimal, and even if it
were, it would never work for other languages.
add two attributes to the <table> element where you can specify
the desired
<table name="toys" singular="toy" plural="toys"/>
If you like this approach, please submit a feature request. If you
don'tmaybe you have an other suggestion?
Cheers,
Aslak
-----Original Message-----
Meyer-Willner, Bernhard
Sent: 8. august 2002 15:30
Subject: [Middlegen-user] Final S gets chopped in CMR methods
Hi,
I wonder if this is a known issue. I have a bean called GlasBean
(ejb-name
is Glas). Another bean has a one-to-one relationship with the
GlasBean.> Problem is, the generated CMR accessors are named
setGla and
getGla instead
of the appropriate setGlas and getGlas. I looked at the template
and the
util methods and it seems there's some messing around going on with
adding/chopping S's depending on the cardinality of the
relationship (s
added if multiplity is many). The generated one-to-many relationship
accessor names are all fine, as are all the other one-to-one
accessors I
have. Can you tell me why the s gets chopped and maybe give me a
hint to
work around this?
Thanks,
Bernie
---
Bernhard Meyer-Willner
Insurance - Financial Services
Logica GmbH
Alster City
Osterbekstrasse 90b
22083 Hamburg (Germany)
(+49) 40-27071-405
(+49) 177-425-9036
www.logica.de
This e-mail and any attachment is for authorised use by the
intended recipient(s) only. It may contain proprietary material,
confidential information and/or be subject to legal privilege.
It should not be copied, disclosed to, retained or used by, any
other party. If you are not an intended recipient then please
promptly delete this e-mail and any attachment and all copies and
inform the sender. Thank you.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
This e-mail and any attachment is for authorised use by the
intended recipient(s) only. It may contain proprietary material,
confidential information and/or be subject to legal privilege. It
should not be copied, disclosed to, retained or used by, any other
party. If you are not an intended recipient then please promptly
delete this e-mail and any attachment and all copies and inform
the sender. Thank you.
This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
Loading...