Re: Cayenne POJO enhancer

From: Gilberto C Andrade (gilbertoc..ecad.to.gov.br)
Date: Thu Oct 25 2007 - 14:41:03 EDT

  • Next message: Andrus Adamchik: "Re: Cayenne POJO enhancer"

    Andrus Adamchik wrote:
    >
    > On Oct 25, 2007, at 7:36 PM, Gilberto C Andrade wrote:
    >>> In other words if that's an offer to work together with Cayenne
    >>> developers to address the things missing or broken in the JPA provider,
    >>> we will gladly accept such help.
    >>
    >> That's the intention! We hope to help and not bring more problem!
    >
    > Very cool. I would suggest to subscribe to the Cayenne dev list when
    > things comes to discussion of the needed Cayenne improvements.
    >
    >> We don't want to use the hibernate tags! Our idea was ignore them and
    >> map it by hand or with cayenne help.
    >> Just think as there not exists any hibernate tag, only the POJO api.
    >> How can we map and use them as is?
    >
    > ....
    >
    >>> As for the documentation, I suggest the JPA spec [1] for the full list
    >>> of annotations.
    >> All this new thing are annotations dependent?
    >
    > Ok, I think now I see what you are getting at. We currently advertise
    > using either traditional Cayenne API (i.e. inherit from
    > CayenneDataObject) or JPA-compatible POJOs (that require either
    > annotations or JPA XML descriptor).
    After take a look at the ejb-3_0-fr-spec-persistence.pdf file, I found
    how we can do it:
    [code]
    An object/relational mapping XML file contains mapping information for
    the classes listed in it. A object/relational mapping XML file named
    orm.xml may be specified in the META-INF directory in the root of the
    persistence unit or in the META-INF directory of any jar file referenced
    by the persistence.xml. Alternatively, or in addition, other mapping
    files may be referenced by the map-ping-file elements of the
    persistence-unit element, and may be present anywhere on the class path.
    [/code]

    Mainly this one:
    [code]
     An orm.xml file or other mapping file is loaded as a resource by the
    persistence provider. If a mapping file is specified, the classes and
    mapping information specified in the mapping file will be
    used.
    [/code]

    Will the cayenne modeler support the ability to add Persistent Types
    (Entities, etc) to the ORM XML?
    This link
    http://www.eclipse.org/webtools/releases/2.0/newandnoteworthy/jpa.php
    (go to the end and see), illustrate the idea.
    >
    > But there is a less-known middle-ground option - POJO's working with
    > traditional Cayenne API. If I understand correctly you'd prefer this
    > option? As we've placed most of the 3.0 effort into JPA, this has been
    > somewhat neglected, but it is still a workable solution. Let me
    > elaborate on it a bit:
    >
    > * It does NOT require annotations.
    > * It does require regular Cayenne mapping created with CayenneModeler.
    > * It does require class enhancement.

    But how can we change/customize the mapping, since we are dealing with a
    legacy database?

    > Here is one simple example - our POJO integration tests subproject:
    >
    > https://svn.apache.org/repos/asf/cayenne/main/trunk/itests/pojo/
    >
    > As you may see, it has a regular Cayenne .map.xml on the classpath, and
    > starts with the agent option: "-javaagent:cayenne-agent-3.0-SNAPSHOT.jar".
    >
    > Andrus
    >
    >
    >
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu Oct 25 2007 - 14:06:32 EDT