On Wed, 2005-04-27 at 09:52 -0400, Mike Kienenberger wrote:
> shaun <wojing..astmail.com.au> wrote:
> > Hi cayenne users,
> >
> > Is it possible to get all relationship and attribute names from a
> > DataObject or would I need to get this info from the DataMap?
> > In EOF i would use the following methods: toOneRelationshipKeys,
> > toManyRelationshipKeys, attributeKeys on an EO.
>
> It's best to get this information from the DataMap. However, you can easily
> add convenience methods to your DataObject class generation template to make
> it more transparent.
>
> For example, here's some code I use to get attributes (inside a DataObject
> class):
>
> EntityResolver entityResolver =
> getDataContext().getEntityResolver();
> ObjEntity objEntity = entityResolver.lookupObjEntity(getClass());
> Collection attributes = objEntity.getAttributes();
I thought I would need to do something like that. I looked at the API
for ObjEntity and it has all the goodies I need. Thanks for your reply
and code example, much appreciated.
cheers
-
shaun
This archive was generated by hypermail 2.0.0 : Wed Apr 27 2005 - 21:21:32 EDT