[ 
https://issues.apache.org/jira/browse/CAY-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrus Adamchik updated CAY-1849:
---------------------------------

    Description: 
Currently when an annotation on listener has no 'value' or 'entityAnnotations' 
parameters, Cayenne fails with an Exception. We should be smarter about this. 
We should check the type of the entity argument and use the type to match 
against entities. E.g. Persistent or DataObject will match all entities, 
MyEntityClass will match just this one entity.

@PostAdd
public void handler1(DataObject o) { }

@PrePersist
public void handler2(MyEntityClass o) {}

@PostUpdate
public void handler2(MyCustomSuperclass o) {}

Potentially this could be somewhat expensive to process (as we'll be analyzing 
full class hierarchies, matching them against EntityResolver), but maybe we can 
make it fairly performant by caching inheritance hierarchies in structures 
similar to EntityInheritanceTree.

  was:
Currently when an annotation on listener has no 'value' or 'entityAnnotations' 
parameters, Cayenne fails with an Exception. We should be smarter about this. 
We should check the type of the entity argument and use the type to match 
against entities. E.g. Persistent or DataObject will match all entities, 
MyEntityClass will match just this one entity. 

Potentially this could be somewhat expensive to process (as we'll be analyzing 
full class hierarchies, matching them against EntityResolver), but maybe we can 
make it fairly performant by caching inheritance hierarchies in structures 
similar to EntityInheritanceTree.

    
> Smart handling of listener lifecycle annotation with no entity filter
> ---------------------------------------------------------------------
>
>                 Key: CAY-1849
>                 URL: https://issues.apache.org/jira/browse/CAY-1849
>             Project: Cayenne
>          Issue Type: Improvement
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>             Fix For: 3.2M2
>
>
> Currently when an annotation on listener has no 'value' or 
> 'entityAnnotations' parameters, Cayenne fails with an Exception. We should be 
> smarter about this. We should check the type of the entity argument and use 
> the type to match against entities. E.g. Persistent or DataObject will match 
> all entities, MyEntityClass will match just this one entity.
> @PostAdd
> public void handler1(DataObject o) { }
> @PrePersist
> public void handler2(MyEntityClass o) {}
> @PostUpdate
> public void handler2(MyCustomSuperclass o) {}
> Potentially this could be somewhat expensive to process (as we'll be 
> analyzing full class hierarchies, matching them against EntityResolver), but 
> maybe we can make it fairly performant by caching inheritance hierarchies in 
> structures similar to EntityInheritanceTree.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to