working with views

From: tnaki..ofthome.net
Date: Tue Apr 12 2005 - 15:43:12 EDT

  • Next message: Fredrik Liden: "ExpressionFactory problems"

    I've used views to get some statistics I require.
    I was at a loss, however, how to go about them using cayenne so the
    patchwork I will talk about is not for the weakhearted. :)
    When I reverse engineer the database schema, a view is basically
    represented the same way a table would be. However, my validation failed
    repeatedly becouse my views lack a primary key - which, considering the
    nature of the information I needed, is as it should be: they just
    provide raw data. The problem boils down to no primary key and no root
    object - I have no idea how to cope with such data using cayenne. I had
    hoped SQLTemplate would do the trick, but it needs a root object and I
    don't have one.
    Anyway, what I did was I introduced primary keys into the views by
    marking whichever column contained unique values as primary keys. Where
    I had no such columns, I made artificial ones. So now everything works,
    but it's patchwork all around and I'd love to hear how it should be done
    next time I need to solve a similar problem.

    Tomislav



    This archive was generated by hypermail 2.0.0 : Tue Apr 12 2005 - 15:39:10 EDT