Incompatible types - generic Value

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Incompatible types - generic Value

Rick F.
Hi all -

When doing this:

String productId = request.getParameter("idValue");
genericValue product1 = null;
Map inputId = UtilMisc.toMap("idValue", productId);

product1 = delegator.findByPrimaryKey("GoodIdentifications", inputId);

productId = product1.get("productId");

I get an compiler error complaining that product1.get("productId") is an object not a string. What am I doing wrong?

Thanks in advance
Rick










Reply | Threaded
Open this post in threaded view
|

Re: Incompatible types - generic Value

cjhowe
try
productId = product1.get("productId").toString();

what you're calling points to this...

http://www.opentaps.org/javadocs/version-0.9.4/framework/api/org/ofbiz/entity/GenericEntity.html#get(java.lang.String,%20java.lang.String,%20java.util.Locale)

--- Richard Fleming <[hidden email]> wrote:

> Hi all -
>
> When doing this:
>
> String productId = request.getParameter("idValue");
> genericValue product1 = null;
> Map inputId = UtilMisc.toMap("idValue", productId);
>
> product1 = delegator.findByPrimaryKey("GoodIdentifications",
> inputId);
>
> productId = product1.get("productId");
>
> I get an compiler error complaining that product1.get("productId") is
> an object not a string. What am I doing wrong?
>
> Thanks in advance
> Rick
>
>
>
>
>
>
>
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Incompatible types - generic Value

cjhowe
...or

productId = product1.getString("productId");
--- Chris Howe <[hidden email]> wrote:

> try
> productId = product1.get("productId").toString();
>
> what you're calling points to this...
>
>
http://www.opentaps.org/javadocs/version-0.9.4/framework/api/org/ofbiz/entity/GenericEntity.html#get(java.lang.String,%20java.lang.String,%20java.util.Locale)

>
> --- Richard Fleming <[hidden email]> wrote:
>
> > Hi all -
> >
> > When doing this:
> >
> > String productId = request.getParameter("idValue");
> > genericValue product1 = null;
> > Map inputId = UtilMisc.toMap("idValue", productId);
> >
> > product1 = delegator.findByPrimaryKey("GoodIdentifications",
> > inputId);
> >
> > productId = product1.get("productId");
> >
> > I get an compiler error complaining that product1.get("productId")
> is
> > an object not a string. What am I doing wrong?
> >
> > Thanks in advance
> > Rick
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Incompatible types - generic Value

Jacques Le Roux
Administrator
In this case I would prefer the second.

Jacques

----- Message d'origine -----
De : "Chris Howe" <[hidden email]>
À : <[hidden email]>
Envoyé : samedi 2 juin 2007 22:32
Objet : Re: Incompatible types - generic Value


> ...or
>
> productId = product1.getString("productId");
> --- Chris Howe <[hidden email]> wrote:
>
> > try
> > productId = product1.get("productId").toString();
> >
> > what you're calling points to this...
> >
> >
>
http://www.opentaps.org/javadocs/version-0.9.4/framework/api/org/ofbiz/entity/GenericEntity.html#get(java.lang.String,%20java.lang.String,%20java.util.Locale)

> >
> > --- Richard Fleming <[hidden email]> wrote:
> >
> > > Hi all -
> > >
> > > When doing this:
> > >
> > > String productId = request.getParameter("idValue");
> > > genericValue product1 = null;
> > > Map inputId = UtilMisc.toMap("idValue", productId);
> > >
> > > product1 = delegator.findByPrimaryKey("GoodIdentifications",
> > > inputId);
> > >
> > > productId = product1.get("productId");
> > >
> > > I get an compiler error complaining that product1.get("productId")
> > is
> > > an object not a string. What am I doing wrong?
> > >
> > > Thanks in advance
> > > Rick
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >