cannot get value from findByPrimaryCache

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

cannot get value from findByPrimaryCache

Hari Plaikoil
Hi All,

Would you like to help me, how to fetch value from a variable which its type is GenericValue?
this is my code:

GenericValue product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId",productId ));

I want to get the weight's value by this code:

double weight = product.getDouble("weight").doubleValue();

but, I don't have any value store in weight's variable.

I don't know what mistakes I've done. Please help me.


Thank you
Reply | Threaded
Open this post in threaded view
|

Re: cannot get value from findByPrimaryCache

STELTZLEN Charles
Hi Hari,

Code seems to be ok.

Sure that the product weight you want is stored in Product ?

Don't forget to refresh your cache if you have store the product
weight just before this reading.


Hari Plaikoil a écrit :

> Hi All,
>
> Would you like to help me, how to fetch value from a variable which its type
> is GenericValue?
> this is my code:
>
> GenericValue product = delegator.findByPrimaryKeyCache("Product",
> UtilMisc.toMap("productId",productId ));
>
> I want to get the weight's value by this code:
>
> double weight = product.getDouble("weight").doubleValue();
>
> but, I don't have any value store in weight's variable.
>
> I don't know what mistakes I've done. Please help me.
>
>
> Thank you
>  

Reply | Threaded
Open this post in threaded view
|

Re: cannot get value from findByPrimaryCache

Hari Plaikoil
Thank you Charles for your help.

The problem has been solved, I didn't give much attention with the whole process that made me stuck with that problem.

But everything is okay right now.

rgds

STELTZLEN Charles wrote
Hi Hari,

Code seems to be ok.

Sure that the product weight you want is stored in Product ?

Don't forget to refresh your cache if you have store the product
weight just before this reading.


Hari Plaikoil a écrit :
> Hi All,
>
> Would you like to help me, how to fetch value from a variable which its type
> is GenericValue?
> this is my code:
>
> GenericValue product = delegator.findByPrimaryKeyCache("Product",
> UtilMisc.toMap("productId",productId ));
>
> I want to get the weight's value by this code:
>
> double weight = product.getDouble("weight").doubleValue();
>
> but, I don't have any value store in weight's variable.
>
> I don't know what mistakes I've done. Please help me.
>
>
> Thank you
>