Re: Computed Attributes

From: Bruce Alspaugh (compulinklt..mail.com)
Date: Fri Feb 17 2006 - 11:29:50 EST

  • Next message: Gentry, Michael \(Contractor\): "RE: username/password in node xml definition"

    I agree with Jurgen. It would be really nice if I could go into the data
    modeler and leave the DbAttribute blank or set it to something like
    "User-defined" on an ObjAttribute. The next time I generate classes, the
    modeler would create an empty stub method with a comment reminding me to
    fill it in. The engine would know that this is a read-only transient
    attribute and not try to persist or validate it. As it is now, I get an
    error in the modeler if I try to generate classes with the DbAttribute
    blank.

    Bruce
    ----- Original Message -----
    From: "Jürgen Saar" <Juerge..Saar.org>
    To: <cayenne-use..bjectstyle.org>
    Sent: Friday, February 17, 2006 1:42 AM
    Subject: RE: Re: Computed Attributes

    > Yes ist does cover most unusually need,
    > but there a 2 additional aspects:
    >
    > -- 1 --
    > For generation tasks, like velocity, it would be helpful
    > if they can be controlled by repository
    >
    > -- 2 --
    > In the team it brings more transparency for
    > the Datastructure
    >
    >
    > And I think it should be easy to ignore the
    > transient attributes on all db activities
    > within the cayenne engine.
    >
    >
    >
    > 2006/2/16, Joshua Pyle <joshua.t.pyl..mail.com>
    >>
    >> Maybe I'm over simplifying but if I need an attribute on a cayenne
    >> object I just create the appropriate getter and perform whatever calcs
    >> needed in that getter. In the example I provide I'm just formatting a
    >> date but I could also run another query loop through the results and
    >> spit out a sum. I could even execute a SQLTemplate query.
    >>
    >> public class User extends _User{
    >> public String getEntryDateString{
    >> Date toFormat = this.getEntryDate();
    >> if( toFormat == null ){
    >> return "";
    >> }else{
    >> return Util.SIMPLE_DATE.format( toFormat );
    >> }
    >> }
    >>
    >> public Double getComplexThingy{
    >> Double toReturn = new Double(0.0);
    >> // TODO loop through a List of object and perform a complex
    >> calculation
    >> return toReturn;
    >> }
    >> }
    >>
    >> I have yet to find a situation where this does not cover even my most
    >> unusually needs.
    >>
    >> Joshua T. Pyle
    >>
    >
    > __________________________________________________________________________
    > Erweitern Sie FreeMail zu einem noch leistungsstarkeren E-Mail-Postfach!
    > Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131
    >



    This archive was generated by hypermail 2.0.0 : Fri Feb 17 2006 - 11:36:14 EST