Storing lifecycle listebers and callbacks in the *.map.xml and loading them back
--------------------------------------------------------------------------------

                 Key: CAY-879
                 URL: https://issues.apache.org/cayenne/browse/CAY-879
             Project: Cayenne
          Issue Type: Task
          Components: Cayenne Core Library
    Affects Versions: 3.0
            Reporter: Andrus Adamchik
            Assignee: Andrus Adamchik
             Fix For: 3.0


DataMap and ObjEntity classes support mapping lifecycle callbacks, however 
there is no support for loading them from XML and storing them back to XML. 
Here is what needs to be done to achieve that:

1. XML Format Additions (applicable for DataMap XML files - *.map.xml)

* new "entity-listener" tag as a child of "obj-entity", describing callbacks on 
listener classes separate from the entity class. The tag itself is compatible 
with JPA spec. Here is an example:

<obj-entity ...>
  ... 
  <entity-listener class="mylistenerclass">
          <pre-persist method-name="abc"/>
          <post-update method-name="xyz"/>
  </entity-listener>
</obj-entity>

* new callback tags - children of "obj-entity", describing callbacks on the 
entity class itself. The tags are compatible with JPA spec. Here is an example:

<obj-entity ...>
  ... 
  <pre-persist method-name="abc"/>
  <post-update method-name="xyz"/>
</obj-entity>

* new "obj-entity" tag attributes: "exclude-superclass-listeners", 
"exclude-default-listeners".

* new "entity-listener" tag as a child of "data-map", describing default 
callbacks on all entities. Format is the same as for the "obj-entity":

<data-map ...>
  ... 
  <entity-listener class="mylistenerclass">
          <pre-persist method-name="abc"/>
          <post-update method-name="xyz"/>
  </entity-listener>
</data-map>

* Implement listener saving in DataMap.encodeAsXML(..)
* Implement listener and callback saving in ObjEntity.encodeAsXML
* Implement listener and callback loading in MapLoader.
* Write unit tests




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to