Thanks Mike, worked a treat. I'd just add this line:
DbAttribute dbAttr = (DbAttribute)
aDbEntity.getAttribute("some_db_fld_name");
//Then we can do things like:
dbAttr.getMaxLength();
----- Original message -----
From: "Mike Kienenberger" <mkienen..laska.net>
To: "Steve Wells" <stwell..wnmail.net>
Date: Fri, 26 Mar 2004 01:29:28 -0500
Subject: Re: Object Metadata
Steve Wells <stwell..wnmail.net> wrote:
> Does anyone know if its possible to programatically get any info about a
> data object? In particular I'm after the field length. Using 1.1 M4.
> I've noticed there is DbAttribute.getMaxLength() method, but can't figure
> how to get to this from a CayenneDataObject.
Don't have time to answer this comprehensively, but look at
EntityResolver,
Ie,
EntityResolver anEntityResolver =
aDataContext.getEntityResolver();
DbEntity aDbEntity = anEntityResolver.lookupDbEntity(aClass);
This is just one example I had in front of me.
-- http://www.fastmail.fm - Access your email from home and the web
This archive was generated by hypermail 2.0.0 : Fri Mar 26 2004 - 03:21:38 EST