Re: QueryTable / Non-persisted DataObject [Was: Questions about Ordering, Optimistic Locking and QueryTable]

From: Mike Kienenberger (mkienen..mail.com)
Date: Tue May 20 2008 - 15:51:28 EDT

  • Next message: Kevin Menard: "Re: [POLL] loading XML configurations from filesystem"

    Well, the other thing you can do is work with Interfaces everywhere,
    then create POJO classes implementing your interface for non-persisted
    objects. Don't know if that works any better for your particular
    situation, though.

    I've done this for a project with Cayenne, and I created cgen
    templates to automatically create the interfaces as well as the
    concrete Cayenne DataObject classes. I also created POJO objects for
    unit testing and data transfer objects using cgen templates. The only
    trick was handling reverse relationship setting in the base class of
    the POJO objects, but it was doable.

    On 5/20/08, Adrian Wiesmann <awiesman..omap.org> wrote:
    > On Mon, 19 May 2008 11:07:11 -0400
    > "Mike Kienenberger" <mkienen..mail.com> wrote:
    >
    > > I'm not really sure why you don't use a regular java bean object to do
    > > this.
    >
    >
    > Because of the base class. I don't want to have my renderer check the
    > class to decide how to handle it. What I could try would be to subclass
    > from DataObject without having any info in the DataMap. Not sure how
    > Cayenne would like that though.
    >
    >
    >
    > > However, I believe you could create a DataMap for all of these objects
    > > in a separate DataNode. You don't have to create a table for them in
    > > the database.
    >
    >
    > That could be a solution. Ugly, but still working.
    >
    >
    >
    > > You might even be able to get away with having them in the same
    > > DataMap, provided you don't try to update/insert/delete them during a
    > > commit. There's no requirement that you create an actual table on
    > > the database unless you execute sql accessing that table.
    >
    >
    > Yes, I thought something like that. But still an ugly solution...
    >
    > Cheers,
    >
    > Adrian
    >



    This archive was generated by hypermail 2.0.0 : Tue May 20 2008 - 15:52:10 EDT