You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Richard Fleming <ri...@thebva.com> on 2007/06/02 22:12:05 UTC

Incompatible types - generic Value

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











Re: Incompatible types - generic Value

Posted by Jacques Le Roux <ja...@les7arts.com>.
In this case I would prefer the second.

Jacques

----- Message d'origine ----- 
De : "Chris Howe" <cj...@yahoo.com>
À : <us...@ofbiz.apache.org>
Envoyé : samedi 2 juin 2007 22:32
Objet : Re: Incompatible types - generic Value


> ...or
>
> productId = product1.getString("productId");
> --- Chris Howe <cj...@yahoo.com> 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 <ri...@thebva.com> 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
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >


Re: Incompatible types - generic Value

Posted by Chris Howe <cj...@yahoo.com>.
...or 

productId = product1.getString("productId");
--- Chris Howe <cj...@yahoo.com> 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 <ri...@thebva.com> 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
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> 
> 


Re: Incompatible types - generic Value

Posted by Chris Howe <cj...@yahoo.com>.
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 <ri...@thebva.com> 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
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>