How to create cayenne datamap on the fly

From: mr.abanjo (mr.abanj..mail.com)
Date: Fri Jul 06 2007 - 18:12:57 EDT

  • Next message: Andrus Adamchik: "Re: How to create cayenne datamap on the fly"

    Hi all,
    i'm writing an application that try to be indipendent from the business
    logic required.
    The main idea behind this project is to use reflection to create on the fly
    the bean (CayenneDataObject) that normally i must write for map the databese
    structure.
    What i need is:
    1) load cayenne data map xml from a URL. Basically this URL point to a
    servlet that generate it on the fly. Normally this is the configuration in
    cayenne.xml:

    <map name="datamap-foo" location="META-INF/cayenne-datamap-foo.map.xml" />

    whant i need is something like this:

     <map name="datamap-foo" location="
    http://somedomain/cayenne-datamap-foo.map.xml" />

    is it possible?

    2) i need to generate some DataObject on the fly. So i'm thinking to use
    Reflection. Do you think that is possible? The main idea is that at runtime
    i don't know the structure of my entity. For example, "user" can be composed
    only by "name" and "surname" attribute... or... have also "address".. and so
    on. I don't want to create every time the corresponding DataObject. I want
    to implements an engine that create them on demand.

    I don't know if this is a right approch on the problem. Maybe cayenne has
    some API for doing this type of activity.

    Thanks in advance, for help.

    D.



    This archive was generated by hypermail 2.0.0 : Fri Jul 06 2007 - 18:13:24 EDT