You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Joel Hockey <jo...@qsipayments.com> on 2002/01/17 01:42:59 UTC
intake and business object mapping: confusing StringKey with Stri
ng in setProperies
I've just started using turbine for a GSM SMS payment gateway application
that I am writing. The idea is to allow builders and plumbers and whatever
to take credit card payments using their mobile phone.
Anyway, I'm using turbine for the web side of things and I've run into a
problem with intake.
I am using intake with mapping to my business object. (I don't have my
exact source with me right now, but it is along the lines of)
<group name="Merchant" key="merchant" mapToObject="om.Merchant">
<field name="Merid" key="merid" type="String">
<rule name="minLength" value="8">Merchant Id must be at least 8
long</rule>
<rule name="maxLength" value="16">Merchant Id must not be longer
than 16</rule>
</field>
.
.
.
</group>
I used torque to generate my Merchant business object. The primary key is
the field Merid. The generated MerchantBase class has two methods to set
the Merid:
setMerid(String s), and setMerid(StringKey sk)
In a screen class for a page where I either create or edit a merchant, I
check for a merchant Id as a parameter from the previous request. If no id
exists, then I create a new merchant object and put it in the context for
velocity and also in the ServletContext.
My action class to handle the submission of the form does
Merchant mer =
(Merchant)data.getServletContext().getAttribute("merchant");
Group g = intake.get("Merchant", mer.getMerid());
g.setProperties(mer);
When I call g.setProperties() I am getting an InvocationTargetException at
line 663 in org.apache.turbine.services.intake.model.Field.setProperty().
The problem is that the field is using the method setMerid(StringKey sk),
but is passing in a String.
Why is intake using the setter method that takes a StringKey rather than the
setter method that takes a String?
Thanks,
Joel Hockey
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: intake and business object mapping: confusing StringKey with String
in setProperies
Posted by John McNally <jm...@collab.net>.
This is a problem with java's bean introspection classes. It is
difficult to fix as there are bugs in different classes in different jdk
versions. The version in cvs will work for jdk1.3.x, I believe. You
can remove the String convenience method from torque's Object.vm
template and regenerate your sources for an easier fix.
john mcnally
Joel Hockey wrote:
>
> I've just started using turbine for a GSM SMS payment gateway application
> that I am writing. The idea is to allow builders and plumbers and whatever
> to take credit card payments using their mobile phone.
>
> Anyway, I'm using turbine for the web side of things and I've run into a
> problem with intake.
>
> I am using intake with mapping to my business object. (I don't have my
> exact source with me right now, but it is along the lines of)
>
> <group name="Merchant" key="merchant" mapToObject="om.Merchant">
> <field name="Merid" key="merid" type="String">
> <rule name="minLength" value="8">Merchant Id must be at least 8
> long</rule>
> <rule name="maxLength" value="16">Merchant Id must not be longer
> than 16</rule>
> </field>
> .
> .
> .
> </group>
>
> I used torque to generate my Merchant business object. The primary key is
> the field Merid. The generated MerchantBase class has two methods to set
> the Merid:
> setMerid(String s), and setMerid(StringKey sk)
>
> In a screen class for a page where I either create or edit a merchant, I
> check for a merchant Id as a parameter from the previous request. If no id
> exists, then I create a new merchant object and put it in the context for
> velocity and also in the ServletContext.
>
> My action class to handle the submission of the form does
>
> Merchant mer =
> (Merchant)data.getServletContext().getAttribute("merchant");
> Group g = intake.get("Merchant", mer.getMerid());
> g.setProperties(mer);
>
> When I call g.setProperties() I am getting an InvocationTargetException at
> line 663 in org.apache.turbine.services.intake.model.Field.setProperty().
>
> The problem is that the field is using the method setMerid(StringKey sk),
> but is passing in a String.
>
> Why is intake using the setter method that takes a StringKey rather than the
> setter method that takes a String?
>
> Thanks,
>
> Joel Hockey
>
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>