Re: transient relations

From: Mike Kienenberger (mkienen..laska.net)
Date: Sat Oct 30 2004 - 09:13:52 EDT

  • Next message: Jürgen Saar: "Re: transient relations"

    =?iso-8859-1?Q? J=FCrgen=20Saar ?= <jsaa..eb.de> wrote:
    > > > there are several own methods in my DataObject.
    > > > The problem comes up with my XML-Export-Class.
    > > > There I build an XML-Stream with all Attributes
    > > > and Relations of the DataObject. The process of
    > > > generating the xml informations is completely
    > > > driven by the repository. The other way would
    > > > be to analyze the DataObjects via reflection,
    > > > but the repository way is very fine for all
    > > > generic classes. Even if you think about
    > > > reporting, like JasperReports, such transient
    > > > informations are needed.
    > >
    > > Can you give a specific example? I don't think I understand what you're

    > > trying to do. An example might clear it up for me.
    >
    > Actually I have this problem:
    >
    > I've go an order object in my database an there is an archive of scanned
    documents.
    > >From the achive I can get a list of URLs of document belonging to this
    order.
    >
    > So what I want is to setup a relation that transparently offers this URLs,
    > as if they were read from the database.
    >
    > I've solved this by creating a DbEntity plus ObjEntity for the URLs
    > and an readonly-relation from order to urls.
    > The handling was put in the order object in readProperty().

    Why not just add a method to the Order class that does something like the
    following?

    public List getUrlList()
    {
            return listOfUrlsCreatedFromArchiveForOrder(this);
    }

    The purpose of Cayenne is to make a database-backed object look like a
    regular java object. It seems that you are trying to do the opposite --
    make a regular java object look like a database-backed object.

    What are you hoping to accomplish? Is there a reason why you want URLs to
    look like a database-backed object that you have not stated? It's unclear
    why you want to create a DBEntity or ObjEntity for URLs.
    Why not leave it as a non-database object?

    -Mike



    This archive was generated by hypermail 2.0.0 : Sat Oct 30 2004 - 09:12:38 EDT