Re: relationship to non-class object

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Dec 02 2005 - 02:16:36 EST

  • Next message: Andrus Adamchik: "Re: newbie questions to well inderstand cayenne framework."

    Todd,

    If you schedule is so dynamic that you want it to be data-driven,
    then it seems like having a separate table for lookup is indeed
    appropriate. It can be an entity of its own, I see no problem with that.

    Also if there is a computable algorithm for determining DayOne vs.
    DayTwo, this can spare you from doing extra data entry. E.g. if one
    schedule always happens on Monday, Wednesday, Friday, and the other
    one on remaining days, you could compute weekday of a given date
    using java.util.Calendar API, and then do a lookup by weekday.

    Andrus

    On Dec 1, 2005, at 1:57 PM, Todd O'Bryan wrote:

    > In my current project, I have an enumeration of possible Day
    > objects. Each Day has its own schedule. In our case, we run two
    > schedules, Day One and Day Two.
    >
    > I've created a day dbEntity with id and value fields, where the
    > value is just "Day One" or "Day Two" and the corresponding Day
    > class. Now I need a way to find which day it is given a date. I can
    > create a lookup table that has a DATE field and a Day object id,
    > which seems the right thing to do, but then I don't know how to
    > access the Day object given a date because the date isn't a cayenne
    > object. Is this a case where it's better to just use bare SQL to
    > grab the day ID from the dateToDay table or is there a more
    > framework-friendly way of doing it?
    >
    > Thanks,
    > Todd
    >
    > P.S. If you could cc your response to my school address (which is
    > in the cc field), I'd really appreciate it. I can't get to my home
    > email from school.
    >



    This archive was generated by hypermail 2.0.0 : Fri Dec 02 2005 - 02:16:41 EST