Hi Andrus,
few further questions for you:
1) The web page "
http://cayenne.apache.org/doc20/generic-persistent-class.html" has a link to
a sample code.. but it desn't work. A sample,is for me, a great help for
speed up my work. Is possible to have it?
2) The datamap xml file, that should map java object to database object, is
still required? I usually write in it, the package and the name of the
concrete class... now what i must insert?
<db-entity name="FOOENTITY">
<db-attribute name="DBFIELD1" type="INTEGER" isPrimaryKey="true"/>
<db-attribute name="DBFIELD2" type="VARCHAR"/>
...
...
</db-entity>
<obj-entity name="FooEntity" readOnly="false" className="*
it.foo.type.FooEntityType*" dbEntityName="FOOENTITY">
<obj-attribute name="DbFiled1" type="java.lang.Long"
db-attribute-path="DBFIELD1" />
<obj-attribute name="DbFiled2" type="java.lang.String"
db-attribute-path="DBFIELD2" />
...
...
</obj-entity>
3) If the datamap xml file is no more required, how Cayenne know which
table are connected to my java classes, how it knows which is the primary
key.. ecc...?
Thanks
D.
On 7/8/07, mr. abanjo <mr.abanj..mail.com> wrote:
>
> Hi Andrus,
> thanks for your help!
> Every time i need something, Cayenne solve my problem :D
>
> D.
>
>
>
> On 7/7/07, Andrus Adamchik <andru..bjectstyle.org> wrote:
> >
> > Hi there,
> >
> > Actually Cayenne is one of the few ORM engines where you can define
> > both your metadata, and persistent objects on the fly if you want to.
> > So...
> >
> > 1. While I never tried loading DataMap XML from a remote URL, it
> > should work. Just subclass
> > 'org.objectstyle.cayenne.conf.DefaultConfiguration', overriding
> > 'getMapConfiguration' method to open a remote URL. You may find this
> > page useful when doing that:
> >
> > http://cayenne.apache.org/doc20/customizing-configuration.html
> >
> > 2. Yes, you can totally do that using generic persistent classes:
> >
> > http://cayenne.apache.org/doc20/generic-persistent-class.html
> >
> > The main trick is to access the objects via DataObject interface
> > methods instead of concrete setters and getters.
> >
> > Andrus
> >
> >
> > On Jul 7, 2007, at 1:12 AM, mr.abanjo wrote:
> >
> > > 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 : Sun Jul 08 2007 - 07:11:03 EDT