Implementing Entity "restricting qualifier" in application?

From: Mike Kienenberger (mkienen..laska.net)
Date: Mon Sep 22 2003 - 14:22:42 EDT

  • Next message: Mike Kienenberger: "Need help with read-only "one" entity in a one-to-many relationship being marked as MODIFIED"

    In the WebObjects application that I'm porting to Cayenne, most of my
    non-read-only entities have restricting qualifers of "INVALIDATED <> 'y'",
    where INVALIDATED is used to represent "deleted" objects (removed from the
    view of the application, but still around for business reasons) in the
    database.

    These qualifiers reside in my database model and not in my application code.

    I'm trying to determine a good way to support this in Cayenne. I don't want
    to have to programmically specify an "Invalidated <> Y" qualifier for each
    query. I can't unilaterally apply the qualifier to all queries through a
    convenience method. I'd be willing to add the code to my generated class
    template somehow, but I can't figure out a way to do it short of calling
    some kind of class reflection method since I only have a "Class" variable to
    my entity and not the ObjEntity.

    Is there an cheap way to get from a Class variable to the ObjEntity?

    Or will I need to add a static method to each of my DataObject subclasses
    and use reflection to look it up [like "public static Qualifier
    restrictingQualifier()"]?

    Anyone have any other ideas?

    It would be nice to do this in such a way so as to allow for some future
    possibility of supporting restrictive qualifiers in the cayenne data model.

    Here's a reference to EOF's restricting qualifiers:

    http://developer.apple.com/documentation/WebObjects/UsingEOModeler/7ModelingInheritance/chapter_7_section_5.html



    This archive was generated by hypermail 2.0.0 : Mon Sep 22 2003 - 14:16:44 EDT