Re: relationship to non-class object

From: Todd O'Bryan (toddobrya..ac.com)
Date: Fri Dec 02 2005 - 06:25:02 EST

  • Next message: Andrus Adamchik: "Re: object regsitered in a different DataContext"

    On Dec 2, 2005, at 2:16 AM, Andrus Adamchik wrote:

    > 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.

    Should I create a class that just has a Date field, then, with a
    relationship to the day? (Actually, now that I say that out loud, it
    seems like that's probably about the easiest thing to do. Just query
    my DateDay class by date and then getDay() from 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.

    Wouldn't that be nice. No, we alternate days back and forth. Except
    that there are random days off for holidays, professional development
    days, etc. We have to print the whole calendar in the students'
    planners at the beginning of the school year.

    Thanks!

    > 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 - 06:25:09 EST