You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Raj <po...@tenth-planet.com> on 2006/08/08 19:08:44 UTC

RE: How to properly access fields from GenericEntity

U CAN CONVERT INTo MAP USING getallfields() method and then u can use.i need
some help on how to see GenericEntity in eclipse debug mode .i can't able to
do.i think ,I miss some classpath in eclipse

-----Original Message-----
From: Jacopo Cappellato [mailto:tiz@sastau.it] 
Sent: Wednesday, August 09, 2006 10:18 AM
To: ofbiz-user@incubator.apache.org
Subject: Re: How to properly access fields from GenericEntity

Hi John,

John Martin wrote:
> I'm trying to integrate another system with ofBiz using a few RMI
> calls.  Not being familiar with the ofBiz objects, I've gotten a
> little stuck.
> 
> I'm calling the userLogin service and get back in the Map, a
> [GenericEntity:UserLogin].  I cast the object back into a
> GenericEntity and attempt to get various fields out but the system
> bombs. Here's my code:
> 
> ...
> RemoteDispatcher rd.Naming.lookup(RMI_URL);
> ...
> Map context = new HashMap();
> context.put("login.username", username);
> context.put("login.password", password);
> Map result = rd.runSync("userLogin", context);
> GenericEntity ge = (GenericEntity) result.get("userLogin");
> // The object looks good in the debugger at this point, I can see the
> key/value pairs
> 

The above line should be:

GenericValue ge = (GenericValue) result.get("userLogin");

The GenericEntity class models the entity definitions, while the 
GenericValue class models the records in the entity.

Jacopo

> String userId =  ge.getString("userLoginId");
> // This is where I try and access a field but it blows up.
> 
> What is the proper way to access the values from the GenericEntity?
> 
> Thanks,
> 
> John



Re: How to properly access fields from GenericEntity

Posted by Chris Howe <cj...@yahoo.com>.
The delegatorName variable is assigned in the web.xml
file for each webapp.  Out of the box all of the
delegatorName variables = "default" which is calling
the definition from
/framework/entity/config/entityengine.xml <deleagotor
name="default" ...> 

So in short, call the same method but set String
delegatorName = (String) "default";

--- John Martin <pb...@gmail.com> wrote:

> Hey Raj,
> 
> Thanks for the getAllFields() call, that worked.  It
> would be nice to
> figure out what the delegator initialization issue
> was though.
> 
> John
> 
> On 8/8/06, Raj <po...@tenth-planet.com>
> wrote:
> > U CAN CONVERT INTo MAP USING getallfields() method
> and then u can use.i need
> > some help on how to see GenericEntity in eclipse
> debug mode .i can't able to
> > do.i think ,I miss some classpath in eclipse
> >
> > -----Original Message-----
> > From: Jacopo Cappellato [mailto:tiz@sastau.it]
> > Sent: Wednesday, August 09, 2006 10:18 AM
> > To: ofbiz-user@incubator.apache.org
> > Subject: Re: How to properly access fields from
> GenericEntity
> >
> > Hi John,
> >
> > John Martin wrote:
> > > I'm trying to integrate another system with
> ofBiz using a few RMI
> > > calls.  Not being familiar with the ofBiz
> objects, I've gotten a
> > > little stuck.
> > >
> > > I'm calling the userLogin service and get back
> in the Map, a
> > > [GenericEntity:UserLogin].  I cast the object
> back into a
> > > GenericEntity and attempt to get various fields
> out but the system
> > > bombs. Here's my code:
> > >
> > > ...
> > > RemoteDispatcher rd.Naming.lookup(RMI_URL);
> > > ...
> > > Map context = new HashMap();
> > > context.put("login.username", username);
> > > context.put("login.password", password);
> > > Map result = rd.runSync("userLogin", context);
> > > GenericEntity ge = (GenericEntity)
> result.get("userLogin");
> > > // The object looks good in the debugger at this
> point, I can see the
> > > key/value pairs
> > >
> >
> > The above line should be:
> >
> > GenericValue ge = (GenericValue)
> result.get("userLogin");
> >
> > The GenericEntity class models the entity
> definitions, while the
> > GenericValue class models the records in the
> entity.
> >
> > Jacopo
> >
> > > String userId =  ge.getString("userLoginId");
> > > // This is where I try and access a field but it
> blows up.
> > >
> > > What is the proper way to access the values from
> the GenericEntity?
> > >
> > > Thanks,
> > >
> > > John
> >
> >
> >
> 


Re: How to properly access fields from GenericEntity

Posted by John Martin <pb...@gmail.com>.
Hey Raj,

Thanks for the getAllFields() call, that worked.  It would be nice to
figure out what the delegator initialization issue was though.

John

On 8/8/06, Raj <po...@tenth-planet.com> wrote:
> U CAN CONVERT INTo MAP USING getallfields() method and then u can use.i need
> some help on how to see GenericEntity in eclipse debug mode .i can't able to
> do.i think ,I miss some classpath in eclipse
>
> -----Original Message-----
> From: Jacopo Cappellato [mailto:tiz@sastau.it]
> Sent: Wednesday, August 09, 2006 10:18 AM
> To: ofbiz-user@incubator.apache.org
> Subject: Re: How to properly access fields from GenericEntity
>
> Hi John,
>
> John Martin wrote:
> > I'm trying to integrate another system with ofBiz using a few RMI
> > calls.  Not being familiar with the ofBiz objects, I've gotten a
> > little stuck.
> >
> > I'm calling the userLogin service and get back in the Map, a
> > [GenericEntity:UserLogin].  I cast the object back into a
> > GenericEntity and attempt to get various fields out but the system
> > bombs. Here's my code:
> >
> > ...
> > RemoteDispatcher rd.Naming.lookup(RMI_URL);
> > ...
> > Map context = new HashMap();
> > context.put("login.username", username);
> > context.put("login.password", password);
> > Map result = rd.runSync("userLogin", context);
> > GenericEntity ge = (GenericEntity) result.get("userLogin");
> > // The object looks good in the debugger at this point, I can see the
> > key/value pairs
> >
>
> The above line should be:
>
> GenericValue ge = (GenericValue) result.get("userLogin");
>
> The GenericEntity class models the entity definitions, while the
> GenericValue class models the records in the entity.
>
> Jacopo
>
> > String userId =  ge.getString("userLoginId");
> > // This is where I try and access a field but it blows up.
> >
> > What is the proper way to access the values from the GenericEntity?
> >
> > Thanks,
> >
> > John
>
>
>